How to make G++ preprocessor output a newline in a macro?
问题 Is there a way in gcc/g++ 4.* to write a macro that expands into several lines? The following code: #define A X \ Y Expands into X Y I need a macro expanding into X Y 回答1: Got it! #define anlb /* */ A /* */ B anlb anlb gcc -E -CC nl.c /* */ A /* */ B /* */ A /* */ B 回答2: Make the macro generate a special markup, say __CR__ , then pipe the result of CPP into a script which translates the macro to a true newline, for example, sed 's/__CR__/\n/g' . I just found this useful to generate a code