[vtkusers] " " vs < > for includes

Francois Bertel francois.bertel at kitware.com
Thu Nov 19 10:47:48 EST 2009


<> :  the compiler looks for header file in the INCLUDE path
"":  the compiler looks in the current directory first, then in the
INCLUDE path.

But this is actually compiler specific. The norm says:

WG14/N843, Committee Draft, section 6.10.2 Source file inclusion, page 136:
ref: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n843.pdf

2 A preprocessing directive of the form
     # include <h-char-sequence> new-line
  searches a sequence of implementation-defined places for a header
identified uniquely by
  the specified sequence between the < and > delimiters, and causes
the replacement of that
  directive by the entire contents of the header. How the places are
specified or the header
  identified is implementation-defined.

3 A preprocessing directive of the form
     # include "q-char-sequence" new-line
  causes the replacement of that directive by the entire contents of
the source file identified
  by the specified sequence between the " delimiters. The named source
file is searched
for in an implementation-defined manner. If this search is not
supported, or if the search
fails, the directive is reprocessed as if it read
    # include <h-char-sequence> new-line
with the identical contained sequence (including > characters, if any)
from the original
directive.


On Thu, Nov 19, 2009 at 10:22 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
> I noticed that most of the includes are done like this:
> #include "vtkPolyData.h"
>
> Don't the quotes mean "look in the current directory", where
> #include <vtkPolyData.h>
>
> means "look on the PATH"?
>
> If this is correct, shouldn't they all use <> since we want to find
> headers in all of the subdirectories (VTK/Graphics, VTK/Filtering,
> etc), which I assume have been put on a header_path type variable by
> cmake?
>
> It clearly works the way it is and I'm sure it is "correct" since the
> whole project does it like this, I was just curious.
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
François Bertel, PhD  | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
                      | Clifton Park NY 12065, USA



More information about the vtkusers mailing list