4 ms·
I believe that the semantics of < > vs "" is actually compiler-dependent but on every compiler that matters, #including with angle brackets is the semantic for
by nvy 2y ago
I believe that the semantics of < > vs "" is actually compiler-dependent but on every compiler that matters, #including with angle brackets is the semantic for "the system header" whereas using quotes gives preference to files in your local source tree.
So for example if you #include <foo> then the compiler (actually the preprocessor, but whatever) looks in the system's standard location, whereas if you #include "foo" then it looks in the local tree.
- ephimetheus 2y agoI think that’s just the ordering though. “” will also end up searching the system paths, it will just check the local paths first.
- ripe 2y agoYou are right; a good explanation of the rules is in the C FAQ [1], which points to a newsgroup posting by Kaz Kylehu [2]. I am posting the summary here, although please do read the original if you have time: The most portable thing to do is to use "" for including files within your project, and to use <> only for implementation supplied files. (Disclosure: I was one of the contributors to the C FAQ). [1] https://c-faq.com/cpp/inclkinds.html https://c-faq.com/cpp/inclkinds.html [2] https://c-faq.com/cpp/inclk.kaz.html https://c-faq.com/cpp/inclk.kaz.html