Reputation: 22695
I was trying to create a shorthand for the following code.
#ifdef TEST_DEF
#define MY_TEST_DEF TEST_DEF
#else
#define MY_TEST_DEF 120
#endif
How do I write the above code as a single line macro
SAFE_DEF(TEST_DEF,MY_TEST_DEF,120)
Upvotes: 0
Views: 360
Reputation: 25752
It is not possible. Every new define must be defined on its own line, and cannot declare a new define in itself.
You will have use the ifdef,else method.
Upvotes: 1