Skip to content

Commit c6dbec6

Browse files
committed
Add linebreaks in paragraphs. NFC.
1 parent 739dc98 commit c6dbec6

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

CppCoreGuidelines.md

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

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

1930219308
##### Example
1930319309

@@ -19310,9 +19316,15 @@ Nevertheless, the guidance is to use the quoted form for including files that ex
1931019316

1931119317
##### Note
1931219318

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

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

1931719329
##### Enforcement
1931819330

0 commit comments

Comments
 (0)