Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
apenn-msft authored Oct 10, 2023
1 parent 6ee25a4 commit 9f38cb2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions CppCoreGuidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -19208,7 +19208,7 @@ Source file rule summary:
* [SF.10: Avoid dependencies on implicitly `#include`d names](#Rs-implicit)
* [SF.11: Header files should be self-contained](#Rs-contained)
* [SF.12: Prefer the quoted form of `#include` for files relative to the including file and the angle bracket form everywhere else](#Rs-incform)
* [SF.13: Use portable header identifiers in `#include` statements](#Rs-portable-headerid)
* [SF.13: Use portable header identifiers in `#include` statements](#Rs-portable-header-id)

* [SF.20: Use `namespace`s to express logical structure](#Rs-namespace)
* [SF.21: Don't use an unnamed (anonymous) namespace in a header](#Rs-unnamed)
Expand Down Expand Up @@ -19632,15 +19632,16 @@ Library creators should put their headers in a folder and have clients include t

A test should identify whether headers referenced via `""` could be referenced with `<>`.

### <a name="Rs-portable-headerid"></a>SF.13: Use portable header identifiers in `#include` statements
### <a name="Rs-portable-header-id"></a>SF.13: Use portable header identifiers in `#include` statements

##### Reason

The [standard](http://eel.is/c++draft/cpp.include) does not specifiy how compilers locate headers from a unique identifier in a '#include' directive, nor does it specify what constitutes uniqueness for an identifier. For example, whether the implementation considers the identifiers to be case-sensitive, or whether the identifiers are file system paths to a header file, and if so, how a hierarchical file system path is delimited.
The [standard](http://eel.is/c++draft/cpp.include) does not specify how compilers locate headers from a unique identifier in a `#include` directive, nor does it specify what constitutes uniqueness for an identifier. For example, whether the implementation considers the identifiers to be case-sensitive, or whether the identifiers are file system paths to a header file, and if so, how a hierarchical file system path is delimited.

To maximize the portability of `#include` directives across compilers, guidance is to:
- use case-sensitivity for the header identifier, matching how the header is defined by the standard, specification, implementation, header file, etc.
- when the header identifier is a hierarchical file system path, use forward-slash '/' to delimit path components as this is the most widely-accepted, portable path-delimiting character.

* use case-sensitivity for the header identifier, matching how the header is defined by the standard, specification, implementation, header file, etc.
* when the header identifier is a hierarchical file system path, use forward-slash `/` to delimit path components as this is the most widely-accepted, portable path-delimiting character.

##### Example

Expand All @@ -19652,11 +19653,11 @@ To maximize the portability of `#include` directives across compilers, guidance
// bad examples
// #include <VECTOR> // the standard library defines a header identified as <vector>, not <VECTOR>
// #include <String> // the standard library defines a header identified as <string>, not <String>
// #include "utils\utils.h" // may not work if '\u' is interpreted as an escape sequence, or on a system where '\' is not a valid path separator
// #include "utils\utils.h" // may not work if `\u` is interpreted as an escape sequence, or on a system where `\` is not a valid path separator

##### Enforcement

It is only possible to enforce on implementations where header identifiers are case-sensitive and which only support '/' as a file path delimiter.
It is only possible to enforce on implementations where header identifiers are case-sensitive and which only support `/` as a file path delimiter.

### <a name="Rs-namespace"></a>SF.20: Use `namespace`s to express logical structure

Expand Down

0 comments on commit 9f38cb2

Please sign in to comment.