0

I have read several posts on StackOverflow regarding difference between " " and <> with #include, use of angular brackets in type casting etc. My question is that what does angular brackets tell the compiler? Or do they have different meaning in different contexts? I am curious about it because I was asked this question in a quiz recently, but it was not clear about how to answer this question.

Cornstalks
  • 37,137
  • 18
  • 79
  • 144
user1325120
  • 85
  • 1
  • 7
  • 2
    http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename – OldProgrammer Nov 15 '14 at 00:42
  • 1
    It's quite possible that whoever made the quiz was expecting a certain answer (which we cannot tell you) but the real answer is that it's implementation-defined. –  Nov 15 '14 at 00:44
  • In the middle of the code, the angular brackets mean that what comes inside is the type of a variable. – SlySherZ Nov 15 '14 at 00:48
  • For contexts other than a `#include` directives, the meaning of `<` and `>` depends on the context, as defined by the language syntax. When they appear in `<` `>` pairs, they're used as part of the syntax for templates, among other things. `<` by itself is the less-than operator; see also `<=`, `>`, and `>=`. `<<` and `>>` are bitwise shift operators. Within a character or string literal, they're just characters. And so on. – Keith Thompson Nov 15 '14 at 00:52

1 Answers1

0

Microsoft Specific

Angle brackets signal to the preprocessor that the header file is in a defined include location (such as specified with the /I option or in the INCLUDE env variable).

Quoted includes perform a more relative search for the header file, starting with the location of the file that has the #include directive. It'll eventually look in the /I and INCLUDE locations.

A full, ordered list of the locations searched can be found here: http://msdn.microsoft.com/en-us/library/36k2cdd4.aspx

Joe R Casey
  • 226
  • 2
  • 8