38 lines
1.6 KiB
Markdown
38 lines
1.6 KiB
Markdown
[cpp.pragma.op]
|
||
|
||
# 15 Preprocessing directives [[cpp]](./#cpp)
|
||
|
||
## 15.13 Pragma operator [cpp.pragma.op]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/preprocessor.tex#L2469)
|
||
|
||
A unary operator expression of the form:
|
||
|
||
_Pragma ( [*string-literal*](lex.string#nt:string-literal "5.13.5 String literals [lex.string]") )
|
||
|
||
is processed as follows: The [*string-literal*](lex.string#nt:string-literal "5.13.5 String literals [lex.string]") is [*destringized*](#def:destringization "15.13 Pragma operator [cpp.pragma.op]") by deleting the L prefix, if present, deleting the leading and trailing
|
||
double-quotes, replacing each escape sequence \" by a double-quote, and
|
||
replacing each escape sequence \\ by a single
|
||
backslash[.](#1.sentence-1)
|
||
|
||
The resulting sequence of characters is processed through translation phase 3
|
||
to produce preprocessing tokens that are executed as if they were the[*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]") in a pragma directive[.](#1.sentence-2)
|
||
|
||
The original four preprocessing
|
||
tokens in the unary operator expression are removed[.](#1.sentence-3)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/preprocessor.tex#L2483)
|
||
|
||
[*Example [1](#example-1)*:
|
||
|
||
#pragma listing on "..\listing.dir" can also be expressed as:_Pragma ( "listing on \"..\\listing.dir\"" )
|
||
|
||
The latter form is processed in the same way whether it appears literally
|
||
as shown, or results from macro replacement, as in:#define LISTING(x) PRAGMA(listing on #x)#define PRAGMA(x) _Pragma(#x) LISTING( ..\listing.dir )
|
||
|
||
â *end example*]
|