问题描述:

for example,I have a macro string A="a", I want to append "b" to A, to become "ab", I tried

#define A "a"

#define A A "b"

and then found it seems become self referential macros which is not possible. I tried to hold the value of A "b" using a temp variable TEMP first, and then undefine A and then define A as TEMP:

#include <sstream>

#define A "a"

#define TEMP A "b"

#undef A

#define A TEMP

int main(){

printf(A);

return 0;

}

but it still cannot compile, why?

相关阅读:
Top