C preprocessor Macro defining Macro

后端 未结 6 1212
耶瑟儿~
耶瑟儿~ 2020-12-29 01:49

Can you do something like this with a macro in C?

#define SUPERMACRO(X,Y) #define X Y

then

SUPERMACRO(A,B) expands to #define A B
<         


        
6条回答
  •  感动是毒
    2020-12-29 01:54

    You might do this though: #define SUPERMACRO(X,Y) define X Y

    Then you can use your editors macro-expansion functionality and paste in the missing #.

    Or even better: Use a different, more powerful string-processing language as your preprocessor.

提交回复
热议问题