Consider code:
#include <stdio.h>
int main() {
int a = 4;
#if 1
printf("Hello world\n");
#endif a ;
printf("a is %d\n", a);
}
Inadvertently, statement a ;
is on the same line as a #endif
and is not evaluated. As a result, the final output is:
Hello world
a is 4
On x86-64 clang 12, this is captured as a warning with using option -Wextra-tokens
. See
CodePudding user response:
There's compiler warning C4067. It looks like you need to set the flag /Za
for it to apply to #endif
directives.