Is there a way to check whether a preprocessor symbol is defined but without value?
Consider the following bit of code:
#if defined( FOO )
#if FOO == 1
#error FOO defined to 1.
#else
#error FOO defined to other value than 1.
#endif
#else
#error FOO undefined
#endif
int main() {}
As is, this will give:
error: #error FOO undefined
If I add #define FOO 1
to the top, I get:
error: #error FOO defined to 1.
So far, so good. But when I change that to #define FOO
(i.e., defining FOO
, but not defining it to something), I get:
error: operator '==' has no left operand
Is there a way to check whether a preprocessor symbol is defined but without value?