Quotes and Brackets In Include Directives

Tim Hollebeek tim@hollebeek.com
Tue Sep 4 15:27:00 GMT 2001


> I always thought that:
> 
> #include <string.h>
> 
> would include the string.h header in the "system" include path while:
> 
> #include "string.h"
> 
> would include a different string.h header file in the "local" include
> path.

You thought wrong.  The relevant standards have always mandated that
the "" search list be a superset of the <> include search list.

Order is, IIRC, implementation defined.

In particular, this means that having local include files with names
that are the same as system headers is asking for trouble.  Various
compilers can and do differ in which one you will get with various
combinations of CWD, -I options, etc.

-Tim



More information about the Gcc mailing list