Code:
#define XXX_A0_YYY "foo"
#define XXX_A1_YYY "bar"
#define getXXX(id) XXX_##id##_YYY
The idea is that getXXX(A0) expands to XXX_A0_YYY and thus the result of "cout << getXXX(0)" is "foo".
However, instead I get the following error message from the compiler: "XXX_id_YYY is undefined".
Why is it not replacing 'id' with the passed parameter?
If I remove "XXX_" from all of the above, it works correctly:
#define A0_YYY "foo"
#define A1_YYY "bar"
#define getXXX(id) id##_YYY
Now "cout << getXXX(A0)" works and prints "foo" on the screen.