what's the "#define XXX" 's value?
c++, string
Solution
As other have said, its definition is empty, that is, in most contexts its replacement text is empty. However, in the constant expression for a `#if` statement, its value is 0:
#define XXX
#if XXX == 0
// yes, we get here
#elif
// no, we don't get here
#endif
Same thing for a name that is not defined at all:
#if YYY == 0
// yes, we get here
#elif
// no, we don't get here
#endif
The difference between those two is that the latter is not defined, and the former is:
#ifdef XXX
// yes, we get here
#endif
#if defined(XXX)
// yes, we get here
#endif
and for `YYY` neither of those tests succeeds.
Problem
what's the "#define XXX" 's value? it has no value but it seems no compile error .normally the define is define type replace, but it is define type wiouht replace str.