How to make G++ preprocessor output a newline in a macro?

前端 未结 8 966
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 15:55

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

8条回答
  •  佛祖请我去吃肉
    2020-12-01 16:22

    I'm pretty sure CPP, being designed for C which doesn't care for newlines, and all, can't handle this kind of work. Still you can mark wanted newlines with some special marker string and pass the result through sed or awk to get what you want.

提交回复
热议问题