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

前端 未结 8 964
隐瞒了意图╮
隐瞒了意图╮ 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

    Got it!

    #define anlb /*
    */ A /*
    */ B
    
    anlb anlb
    

    gcc -E -CC nl.c
    

    /*
    */ A /*
    */ B /*
    */ A /*
    */ B
    

提交回复
热议问题