I have #define
d a preprocessor constant called CurrentClass
.
The macro Method
reads this constant to build a method declaration for the current class.
#define CurrentClass Foo
#define Method(x) \
CurrentClass ## _ ## x
void Method(bar)() {
}
The preprocessor produces the following result:
void CurrentClass_bar() {
}
Obviously, CurrentClass_bar
here should be Foo_bar
.
The following on the other hand produces the correct result.
#define Method(class, x) \
class ## _ ## x
void Method(Foo, bar)() {
}
For some reason, Method
can't concatenate the constant CurrentClass
with something else. CurrentClass
alone produces the desired Foo
string.
Any idea what is happening here?