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

Jed Brown jed at 59A2.org
Sun Mar 13 22:38:40 CDT 2011


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110314/1dd72abd/attachment.html>


More information about the petsc-dev mailing list