Skip to content

Commit f458ada

Browse files
authored
Update CppCoreGuidelines.md
explicitly note that "file" refers to as it exists in the location of it being authored/modified. this is to address any confusion about #including "bar.h" from foo.h based on whether bar.h is relative to foo.h at the time and location foo.h is being modified (e.g. under mylib/foo.h) versus at the time/location from which foo.h is installed to the system and included by the user (e.g. from /usr/include).
1 parent f4c8092 commit f458ada

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CppCoreGuidelines.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -19189,7 +19189,8 @@ 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 library 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 file 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).
19193+
Note that this guidance applies to the including file as it exists in the location where it is typically authored/edited, and not any other location to which it may subsequently be copied or installed or otherwise made available to the implementation.
1919319194

1919419195
##### Example
1919519196

0 commit comments

Comments
 (0)