Despite the fact that this is not good coding practice, I want a macro that should work like the following:
CREATE_STRING(fooBar)
And it should create the following code:
NSString *fooBar = @"fooBar";
My macro looks like this:
#define CREATE_STRING(varName) NSString *varName = @"varName";
But now I get the following
NSString *fooBar = @"varName";
It seems to be such an easy problem to solve and I have already checked the documentation from IBM but I just can’t seem to get the varName into the string.
This is how to do it
It takes advantage of the fact that two string constants one after the other get concatenated by the compiler.