Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What characters are left for pp-tokens?

The spec lists the categories of pp tokens at 2.5, but contains a last category

each non-white-space character that cannot be one of the above

I have a hard time finding an example where a pp token capturing such a character yields a valid C++ program. As 2.5 explains, a program may contain a wild " or ' token, but then behavior is undefined. Is there any example of a valid program?

like image 410
Johannes Schaub - litb Avatar asked Nov 05 '22 08:11

Johannes Schaub - litb


1 Answers

I believe that $ and @, for example, fall into that category (assuming these characters are in the source character set). Both are valid pp-tokens, but are not valid tokens, and will be diagnosed as a syntax error in a later translation phase (unless they've been removed by #if, #ifdef, etc.).

I don't know of any case where such a pp-token results in a valid token.

like image 86
Keith Thompson Avatar answered Nov 10 '22 17:11

Keith Thompson