Skip to content

Commit 9bbc021

Browse files
committed
Add linebreaks in paragraphs. NFC.
1 parent 2e3f983 commit 9bbc021

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

CppCoreGuidelines.md

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

19299-
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 (from within the same component or project) 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).
19299+
Nevertheless, the guidance is to use the quoted form for including files that exist at a relative path
19300+
to the file containing the `#include` statement (from within the same component or project) and to use
19301+
the angle bracket form everywhere else, where possible. This encourages being clear about the locality
19302+
of the file relative to files that include it, or scenarios where the different search algorithm is
19303+
required. It makes it easy to understand at a glance whether a header is being included from a local
19304+
relative file versus a standard library header or a header from the alternate search path (e.g. a header
19305+
from another library or a common set of includes).
1930019306

1930119307
##### Example
1930219308

@@ -19309,9 +19315,15 @@ Nevertheless, the guidance is to use the quoted form for including files that ex
1930919315

1931019316
##### Note
1931119317

19312-
Failing to follow this results in difficult to diagnose errors due to picking up the wrong file by incorrectly specifying the scope when it is included. For example, in a typical case where the `#include ""` search algorithm might search for a file existing at a local relative path first, then using this form to refer to a file that is not locally relative could mean that if a file ever comes into existence at the local relative path (e.g. the including file is moved to a new location), it will now be found ahead of the previous include file and the set of includes will have been changed in an unexpected way.
19318+
Failing to follow this results in difficult to diagnose errors due to picking up the wrong file by
19319+
incorrectly specifying the scope when it is included. For example, in a typical case where the `#include ""`
19320+
search algorithm might search for a file existing at a local relative path first, then using this form to refer
19321+
to a file that is not locally relative could mean that if a file ever comes into existence at the
19322+
local relative path (e.g. the including file is moved to a new location), it will now be found ahead
19323+
of the previous include file and the set of includes will have been changed in an unexpected way.
1931319324

19314-
Library creators should put their headers in a folder and have clients include those files using the relative path `#include <some_library/common.h>`
19325+
Library creators should put their headers in a folder and have clients include those files using the
19326+
relative path `#include <some_library/common.h>`
1931519327

1931619328
##### Enforcement
1931719329

0 commit comments

Comments
 (0)