Sep 27, 2012 at 9:42pm UTC
It converts the "
x " parameter into a null-terminated string. Whatever is given to "
x " when the macro is invoked, the exact value of "
x " will be placed into the string. For example:
1 2
ENUM_OR_STRING(Fluffy_Slippers);
ENUM_OR_STRING(2 * X);
Here, both "
Fluffy_Slippers ", and "
2 * X " will be converted to a null-terminated string.
Wazzak
Last edited on Sep 27, 2012 at 9:42pm UTC
Sep 27, 2012 at 9:48pm UTC
Thanks indeed for you response!
So, basically, the '#' is used to typecast any input to a string, is that it?
Also, I've seen places where a ##x is returned, what does that imply?
ex
#define ENUM_OR_STRING(x) str_##x
Last edited on Sep 27, 2012 at 9:48pm UTC
Sep 28, 2012 at 10:20am UTC
Thanks indeed!!! Helped a lot!!