|
2163 | 2163 | the resulting program to behave in a non-conforming manner. |
2164 | 2164 | Any pragma that is not recognized by the implementation is ignored. |
2165 | 2165 |
|
| 2166 | +\rSec1[cpp.pragma.op]{Pragma operator}% |
| 2167 | +\indextext{macro!pragma operator}% |
| 2168 | +\indextext{operator!pragma|see{macro, pragma operator}} |
| 2169 | + |
| 2170 | +\pnum |
| 2171 | +A unary operator expression of the form: |
| 2172 | +\begin{ncbnf} |
| 2173 | +\terminal{_Pragma} \terminal{(} string-literal \terminal{)} |
| 2174 | +\end{ncbnf} |
| 2175 | +is processed as follows: The \grammarterm{string-literal} is \defnx{destringized}{destringization} |
| 2176 | +by deleting the \tcode{L} prefix, if present, deleting the leading and trailing |
| 2177 | +double-quotes, replacing each escape sequence \tcode{\textbackslash"} by a double-quote, and |
| 2178 | +replacing each escape sequence \tcode{\textbackslash\textbackslash} by a single |
| 2179 | +backslash. The resulting sequence of characters is processed through translation phase 3 |
| 2180 | +to produce preprocessing tokens that are executed as if they were the |
| 2181 | +\grammarterm{pp-tokens} in a pragma directive. The original four preprocessing |
| 2182 | +tokens in the unary operator expression are removed. |
| 2183 | + |
| 2184 | +\pnum |
| 2185 | +\begin{example} |
| 2186 | +\begin{codeblock} |
| 2187 | +#pragma listing on "..\listing.dir" |
| 2188 | +\end{codeblock} |
| 2189 | +can also be expressed as: |
| 2190 | +\begin{codeblock} |
| 2191 | +_Pragma ( "listing on \"..\\listing.dir\"" ) |
| 2192 | +\end{codeblock} |
| 2193 | +The latter form is processed in the same way whether it appears literally |
| 2194 | +as shown, or results from macro replacement, as in: |
| 2195 | +\begin{codeblock} |
| 2196 | +#define LISTING(x) PRAGMA(listing on #x) |
| 2197 | +#define PRAGMA(x) _Pragma(#x) |
| 2198 | + |
| 2199 | +LISTING( ..\listing.dir ) |
| 2200 | +\end{codeblock} |
| 2201 | +\end{example} |
| 2202 | + |
2166 | 2203 | \rSec1[cpp.null]{Null directive}% |
2167 | 2204 | \indextext{preprocessing directive!null} |
2168 | 2205 |
|
|
2471 | 2508 | Any other predefined macro names shall begin with a |
2472 | 2509 | leading underscore followed by an uppercase letter or a second |
2473 | 2510 | underscore. |
2474 | | - |
2475 | | -\rSec1[cpp.pragma.op]{Pragma operator}% |
2476 | | -\indextext{macro!pragma operator}% |
2477 | | -\indextext{operator!pragma|see{macro, pragma operator}} |
2478 | | - |
2479 | | -\pnum |
2480 | | -A unary operator expression of the form: |
2481 | | -\begin{ncbnf} |
2482 | | -\terminal{_Pragma} \terminal{(} string-literal \terminal{)} |
2483 | | -\end{ncbnf} |
2484 | | -is processed as follows: The \grammarterm{string-literal} is \defnx{destringized}{destringization} |
2485 | | -by deleting the \tcode{L} prefix, if present, deleting the leading and trailing |
2486 | | -double-quotes, replacing each escape sequence \tcode{\textbackslash"} by a double-quote, and |
2487 | | -replacing each escape sequence \tcode{\textbackslash\textbackslash} by a single |
2488 | | -backslash. The resulting sequence of characters is processed through translation phase 3 |
2489 | | -to produce preprocessing tokens that are executed as if they were the |
2490 | | -\grammarterm{pp-tokens} in a pragma directive. The original four preprocessing |
2491 | | -tokens in the unary operator expression are removed. |
2492 | | - |
2493 | | -\pnum |
2494 | | -\begin{example} |
2495 | | -\begin{codeblock} |
2496 | | -#pragma listing on "..\listing.dir" |
2497 | | -\end{codeblock} |
2498 | | -can also be expressed as: |
2499 | | -\begin{codeblock} |
2500 | | -_Pragma ( "listing on \"..\\listing.dir\"" ) |
2501 | | -\end{codeblock} |
2502 | | -The latter form is processed in the same way whether it appears literally |
2503 | | -as shown, or results from macro replacement, as in: |
2504 | | -\begin{codeblock} |
2505 | | -#define LISTING(x) PRAGMA(listing on #x) |
2506 | | -#define PRAGMA(x) _Pragma(#x) |
2507 | | - |
2508 | | -LISTING( ..\listing.dir ) |
2509 | | -\end{codeblock} |
2510 | | -\end{example} |
2511 | 2511 | \indextext{preprocessing directive|)} |
0 commit comments