Skip to content

Commit f4c8092

Browse files
authored
Update CppCoreGuidelines.md
1 parent 4e61010 commit f4c8092

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CppCoreGuidelines.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19189,13 +19189,13 @@ The [standard](http://eel.is/c++draft/cpp.include) provides flexibility for comp
1918919189
the two forms of `#include` selected using the angle (`<>`) or quoted (`""`) syntax. Vendors take
1919019190
advantage of this and use different search algorithms and methods for specifying the include path.
1919119191

19192-
Nevertheless, the guidance is to use the quoted form for including files that exist at a relative path to the file containing the `#include` statement and to use the angle bracket form everywhere else, where possible. This encourages being clear about the locality of the header relative to files that include it, or scenarios where the different search algorithm is required. It makes it easy to understand at a glance whether a header is being included from a local relative file versus a standard library header or a header from the alternate search path (e.g. a header from another project or a common set of includes).
19192+
Nevertheless, the guidance is to use the quoted form for including files that exist at a relative path to the file containing the `#include` statement and to use the angle bracket form everywhere else, where possible. This encourages being clear about the locality of the header relative to files that include it, or scenarios where the different search algorithm is required. It makes it easy to understand at a glance whether a header is being included from a local relative file versus a standard library header or a header from the alternate search path (e.g. a header from another library or a common set of includes).
1919319193

1919419194
##### Example
1919519195

1919619196
// foo.cpp:
1919719197
#include <string> // From the standard library, requires the <> form
19198-
#include <some_library/common.h> // A file that is not locally relative, included from another project; use the <> form
19198+
#include <some_library/common.h> // A file that is not locally relative, included from another library; use the <> form
1919919199
#include "foo.h" // A file locally relative to foo.cpp, use the "" form
1920019200
#include "foo_utils/utils.h" // A file locally relative to foo.cpp, use the "" form
1920119201

0 commit comments

Comments
 (0)