In C++, is this:
#ifdef A && B
the same as:
#if defined(A) && defined(B)
?
I was thinking it wasn't, but I haven't been able to find a difference with my compiler (VS2005).
In C++, is this:
#ifdef A && B
the same as:
#if defined(A) && defined(B)
?
I was thinking it wasn't, but I haven't been able to find a difference with my compiler (VS2005).
Conditional Compilation
I think maybe OP want to ask about the statment "#if COND_A && COND_B", not "#ifdef COND_A && COND_B"...
They are also different. "#if COND_A && COND_B" can judge logic express, just like this:
even, a variable in your code also can be used in this macro statment:
As of VS2015 none of the above works. The correct directive is:
see more here
For those that might be looking for example (UNIX/g++) that is a little different from the OP, this may help:
`
The following results are the same:
1.
2.
They are not the same. The first one doesn't work (I tested in gcc 4.4.1). Error message was:
If you want to check if multiple things are defined, use the second one.