tags:

views:

101

answers:

3
+5  A: 

It's to denote that the header isn't system-wide.

This is a convention, not a requirement.

By the way, those aren't inverted commas, they're quotation marks. There is a difference in the field of typography.

Borealid
<> aren't braces either ... :p
Yuji
typographically speaking, they're not true quotation marks either. Quotation marks look like “this”, not "this". :)
jalf
+2  A: 

At least for C, it makes no difference nowadays. The ISO standard states that the location of the files is implementation defined in both cases.

The usual way is to use <> for system headers (things under /usr/include for example) and "" for your own headers, but it's not required.

The relevant bits of C99 are from 6.10.2, "Source file inclusion", quoted below.


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.

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.

paxdiablo
quote and link the standard for bonus points :D
Matt Joiner
Why bother, Matt? It's quoted in probably every other dup of this: http://stackoverflow.com/questions/3162030/difference-between-angle-bracket-and-double-quotes-while-including-header/3162067#3162067 http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename/77092#77092
Gabe
+1  A: 

Yeah, from what I've heard, angle brackets (<'s) are used to denote that the header was provided with the compiler, OR that the compiler has been told about a directory in which the header file can be found (-I). Quotes ("'s) are usually used for header files within the source tree. But like others have mentioned, it's not a requirement.

Jorge Israel Peña
Even if the header is within the source tree, you still have to tell the compiler how to find it. `-I.` is not the default.
Borealid
What? I never said -I was the default ... I said < is for something like <string>, or if you specify a path with -I
Jorge Israel Peña