[petsc-dev] reminder never use #include "mylocalinclude.h" in PETSc source

Dmitry Karpeev karpeev at mcs.anl.gov
Sun Mar 13 23:01:10 CDT 2011


So it is okay to include headers from the source tree other than from
under $PETSC_DIR/include?
I thought the subject of this thread expressly banned that.

Dmitry.

On Sun, Mar 13, 2011 at 10:38 PM, Jed Brown <jed at 59a2.org> wrote:
> On Tue, May 4, 2010 at 01:08, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>>
>>> The POSIX resolution semantics don't have anything to do with the
>>> compiler's working directory ($PWD), it has only to do with the location
>>> of the file.  Using the full path makes sense if you want to relocate
>>> *.c files *without* moving their accompanying headers (you'd have to
>>> edit the file if you wanted to use a relocated header).  In this case,
>>> it would still be (more) correct to include the header with angle
>>> brackets instead of quotes (because correctness requires that the header
>>> is *not* found by following the path from the directory where the source
>>> file resides, we're relying on the header being found only after falling
>>> back to angle-bracket semantics).
>>
>>  Perhaps we should change them to use <>
>
> I pushed this change. For consistency, if you want to include a file in the
> same directory as the source file, use #include "header.h". If the file is
> to be looked up in a system path or in some location specified by -I/path
> (such as -I$PETSC_DIR/include), then use #include <header.h>. Speak up if
> this has caused any problems.



More information about the petsc-dev mailing list