<div dir="ltr">This package is pretty cool.<br><br><a href="http://code.google.com/p/include-what-you-use/" target="_blank">http://code.google.com/p/include-what-you-use/</a><br><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Feb 15, 2013 at 11:28 AM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">We currently use recursive includes everywhere, so petscdmda.h includes all of petscao.h just so it can declare DMDAGetAO and similar. Of course most users of (and implementation files in) DMDA do not reference AO so they don't need to know about all the AO functions.<div>
<br></div><div>The normal approach to this is to forward-declare the type, so instead of</div><div><br></div><div>#include <petscao.h> /* includes lots of other stuff */</div><div>PETSC_EXTERN PetscErrorCode DMDAGetAO(DM,AO*);<br>
</div><div><br></div><div>one would write</div><div><br></div><div>typedef struct _p_AO *AO;</div><div>PETSC_EXTERN PetscErrorCode DMDAGetAO(DM,AO*);<br></div><div><br></div><div>
in which case all three files in PETSc that actually call AO routines would need to include petscao.h. That is arguably a good thing since it makes the actual dependencies more explicit, and is recommended by many (mostly C++) style guidelines.</div>
<div><br></div><div>Is this something worth considering? I think stuff like petscvec.h and petscmat.h ends up pretty much always being needed, but petscdm.h is only used by a handful of files in petscksp and above, for example.</div>
<div><br></div><div>It might be nice to get rarely-used stuff like petscdraw.h out of petscsys.h.</div></div>
</blockquote></div><br></div></div>