I have the following macro in C++
#define AppLogExceptionIf(condition, ...) ((void) 0)
I was wondering whether the condition would still get executed? Am I right in thinking the expansion is equivalent to a
false;
statement regardless of the condition, eg:
AppLogExceptionIf(0 == (x = 5), "Big problem!");
Would not assign to x?
No,
conditionwill not be evaluated. WhereverAppLogExceptionIfappears with parentheses and at least one argument after it will be textually replaced with((void) 0)before the compiler has a chance to see the code, and will do absolutely nothing, like you indicated that you thought.