[petsc-dev] Forward declarations of types?
Barry Smith
bsmith at mcs.anl.gov
Fri Feb 15 16:23:20 CST 2013
On Feb 15, 2013, at 4:10 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Fri, Feb 15, 2013 at 3:59 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> Ok, I did an implementation with petscdrawtypes.h included by petscdraw.h, petscksp.h and petscsnes.h
>
> Should it go in petsc-private because it generally doesn't make sense for users to include directly? Or stay out of petsc-private because it's "safe" to include if that's what they want?
>
> not ideal (I hate having lots of little includes around) but it does keep the PetscDrawLG typedef out of petscys.h
>
> People ok with me pushing?
>
> Yup, should I try doing the same with petscdm.h? I see it as perhaps the biggest funny dependency exposed by include-graph.sh.
Yes. Note when you do this it decreases the need to have separate petscdmxxx.h files :-)
Barry
>
>
> Barry
>
> Currently only PetscDrawLG is in there, since that is the only one needed but others or all could be put there if desired.
>
> On Feb 15, 2013, at 3:44 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
> > On Fri, Feb 15, 2013 at 3:38 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> >
> > Heh, I thought I remembered that duplicate typedefs were invalid in C, but gcc happily compiled it without a warning. In fact, they _are_ allowed in C11, but not in our old, crusty version of C.
> >
> > From the looks of it, the C forum never explicitly intended for it to be invalid, but as a consequence of the classification of typedef in C (typedef is classified differently in C++), it would have needed to be explicitly allowed. C11 added that clause.
> >
> > http://stackoverflow.com/a/8595191/33208
> >
>
>
More information about the petsc-dev
mailing list