Implementation of string literal concatenation in C and C++

后端 未结 5 1960
北海茫月
北海茫月 2021-01-12 03:05

AFAIK, this question applies equally to C and C++

Step 6 of the \"translation phases\" specified in the C standard (5.1.1.

5条回答
  •  庸人自扰
    2021-01-12 03:27

    I would handle it in the scanning token part of the parser, so in the compiler. It seems more logical. The preprocessor has not to know the "structure" of the language, and in fact it ignores it usually so that macros can generate uncompilable code. It handles nothing more than what it is entitled to handle by directives that are specifically addressed to it (# ...), and the "consequences" of them (like those of a #define x h, which would make the preprocessor change a lot of x into h)

提交回复
热议问题