6.10.9 Pragma operator

Previous Table of Contents "New C Standard" commentary

2030 A unary operator expression of the form:

  _Pragma ( string-literal )

is processed as follows: The string literal is destringized 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.

2031 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 in a pragma directive.

2032 The original four preprocessing tokens in the unary operator expression are removed.

2033 EXAMPLE A directive of the form:


        #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 )

Next

Created at: 2008-01-30 02:39:45 The text from WG14/N1256 is copyright © ISO