tmp/tmpw1ay24up/{from.md → to.md}
RENAMED
|
@@ -1,58 +1,77 @@
|
|
| 1 |
## Source file inclusion <a id="cpp.include">[[cpp.include]]</a>
|
| 2 |
|
| 3 |
-
A
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
A
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
identified uniquely by the specified sequence between the `<` and `>`
|
| 14 |
-
delimiters, and causes the replacement of that directive by the entire
|
| 15 |
-
contents of the header. How the places are specified or the header
|
| 16 |
-
identified is *implementation-defined*.
|
| 17 |
|
| 18 |
A preprocessing directive of the form
|
| 19 |
|
| 20 |
``` bnf
|
| 21 |
-
'# include
|
| 22 |
```
|
| 23 |
|
| 24 |
causes the replacement of that directive by the entire contents of the
|
| 25 |
-
source file identified by
|
| 26 |
-
|
| 27 |
-
*
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
``` bnf
|
| 31 |
-
'
|
| 32 |
```
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
A preprocessing directive of the form
|
| 38 |
|
| 39 |
``` bnf
|
| 40 |
'# include' pp-tokens new-line
|
| 41 |
```
|
| 42 |
|
| 43 |
-
(that does not match
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
*
|
| 54 |
|
| 55 |
The implementation shall provide unique mappings for sequences
|
| 56 |
consisting of one or more *nondigit*s or *digit*s [[lex.name]] followed
|
| 57 |
by a period (`.`) and a single *nondigit*. The first character shall not
|
| 58 |
be a *digit*. The implementation may ignore distinctions of alphabetical
|
|
@@ -66,14 +85,14 @@ If the header identified by the *header-name* denotes an importable
|
|
| 66 |
header [[module.import]], it is *implementation-defined* whether the
|
| 67 |
`#include` preprocessing directive is instead replaced by an `import`
|
| 68 |
directive [[cpp.import]] of the form
|
| 69 |
|
| 70 |
``` bnf
|
| 71 |
-
|
| 72 |
```
|
| 73 |
|
| 74 |
-
[*Note
|
| 75 |
|
| 76 |
An implementation can provide a mechanism for making arbitrary source
|
| 77 |
files available to the `< >` search. However, using the `< >` form for
|
| 78 |
headers provided with the implementation and the `" "` form for sources
|
| 79 |
outside the control of the implementation achieves wider portability.
|
|
|
|
| 1 |
## Source file inclusion <a id="cpp.include">[[cpp.include]]</a>
|
| 2 |
|
| 3 |
+
A *header search* for a sequence of characters searches a sequence of
|
| 4 |
+
places for a header identified uniquely by that sequence of characters.
|
| 5 |
+
How the places are determined or the header identified is
|
| 6 |
+
*implementation-defined*.
|
| 7 |
|
| 8 |
+
A *source file search* for a sequence of characters attempts to identify
|
| 9 |
+
a source file that is named by the sequence of characters. The named
|
| 10 |
+
source file is searched for in an *implementation-defined* manner. If
|
| 11 |
+
the implementation does not support a source file search for that
|
| 12 |
+
sequence of characters, or if the search fails, the result of the source
|
| 13 |
+
file search is the result of a header search for the same sequence of
|
| 14 |
+
characters.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
A preprocessing directive of the form
|
| 17 |
|
| 18 |
``` bnf
|
| 19 |
+
'# include' header-name new-line
|
| 20 |
```
|
| 21 |
|
| 22 |
causes the replacement of that directive by the entire contents of the
|
| 23 |
+
header or source file identified by *header-name*.
|
| 24 |
+
|
| 25 |
+
If the *header-name* is of the form
|
| 26 |
+
|
| 27 |
+
``` bnf
|
| 28 |
+
'<' h-char-sequence '>'
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
a header is identified by a header search for the sequence of characters
|
| 32 |
+
of the *h-char-sequence*.
|
| 33 |
+
|
| 34 |
+
If the *header-name* is of the form
|
| 35 |
|
| 36 |
``` bnf
|
| 37 |
+
'"' q-char-sequence '"'
|
| 38 |
```
|
| 39 |
|
| 40 |
+
the source file or header is identified by a source file search for the
|
| 41 |
+
sequence of characters of the *q-char-sequence*.
|
| 42 |
+
|
| 43 |
+
If a header search fails, or if a source file search or header search
|
| 44 |
+
identifies a header or source file that cannot be processed by the
|
| 45 |
+
implementation, the program is ill-formed.
|
| 46 |
+
|
| 47 |
+
[*Note 1*: If the header or source file cannot be processed, the
|
| 48 |
+
program is ill-formed even when evaluating
|
| 49 |
+
`__has_include`. — *end note*]
|
| 50 |
|
| 51 |
A preprocessing directive of the form
|
| 52 |
|
| 53 |
``` bnf
|
| 54 |
'# include' pp-tokens new-line
|
| 55 |
```
|
| 56 |
|
| 57 |
+
(that does not match the previous form) is permitted. The preprocessing
|
| 58 |
+
tokens after `include` in the directive are processed just as in normal
|
| 59 |
+
text (i.e., each identifier currently defined as a macro name is
|
| 60 |
+
replaced by its replacement list of preprocessing tokens). Then, an
|
| 61 |
+
attempt is made to form a *header-name* preprocessing token
|
| 62 |
+
[[lex.header]] from the whitespace and the characters of the spellings
|
| 63 |
+
of the resulting sequence of preprocessing tokens; the treatment of
|
| 64 |
+
whitespace is *implementation-defined*. If the attempt succeeds, the
|
| 65 |
+
directive with the so-formed *header-name* is processed as specified for
|
| 66 |
+
the previous form. Otherwise, the program is ill-formed, no diagnostic
|
| 67 |
+
required.
|
| 68 |
|
| 69 |
+
[*Note 2*: Adjacent *string-literal*s are not concatenated into a
|
| 70 |
+
single *string-literal* (see the translation phases in [[lex.phases]]);
|
| 71 |
+
thus, an expansion that results in two *string-literal*s is an invalid
|
| 72 |
+
directive. — *end note*]
|
| 73 |
|
| 74 |
The implementation shall provide unique mappings for sequences
|
| 75 |
consisting of one or more *nondigit*s or *digit*s [[lex.name]] followed
|
| 76 |
by a period (`.`) and a single *nondigit*. The first character shall not
|
| 77 |
be a *digit*. The implementation may ignore distinctions of alphabetical
|
|
|
|
| 85 |
header [[module.import]], it is *implementation-defined* whether the
|
| 86 |
`#include` preprocessing directive is instead replaced by an `import`
|
| 87 |
directive [[cpp.import]] of the form
|
| 88 |
|
| 89 |
``` bnf
|
| 90 |
+
import header-name ';' new-line
|
| 91 |
```
|
| 92 |
|
| 93 |
+
[*Note 3*:
|
| 94 |
|
| 95 |
An implementation can provide a mechanism for making arbitrary source
|
| 96 |
files available to the `< >` search. However, using the `< >` form for
|
| 97 |
headers provided with the implementation and the `" "` form for sources
|
| 98 |
outside the control of the implementation achieves wider portability.
|