It is unclear to me when using compiler directives which of the below two code snippets is correct/preferred and why. It seems that most developers and Open Source projects I\'v
As I know, the finest choice is:
#ifndef DEBUG
NSLog(@"-1");
#elif DEBUG == 0
NSLog(@"0");
#else
NSLog(@"%d", DEBUG);
#endif
then, you will know #ifndef DEBUG
is preferred above all others.
There is a simpler choice:
#if DEBUG == 0 // DEBUG is not defined or defined to be 0
// do sth
#else
// do sth
#endif
However, if -Wundef compiler flag is on, there might be a warning with #if DEBUG == 0
.