Reputation: 1008
I would like to do this:
#if ID1 < 10
#define ID1_STR "0" #ID1
#else
#define ID1_STR #ID1
#endif
But, I don't want to repeat this for every "ID". Is there a way I can create some wrapper, where I can just do this:
WRAPPER(ID1)
Upvotes: 1
Views: 53
Reputation: 1974
Can't be done with the preprocessor, since it is not possible for a macro to expand to a set of preprocessor directives (#if, #define, etc). And that's what would be needed to do what you seek.
Upvotes: 1