Why #if 0 vs #if (1 > 1)?
Both expressions are false, so the code is never compiled.
Here are potential explanations for why the programmer did not want to use the obvious #if 0
preprocessor directive to disable a section of code:
- the programmer did not want
grep '#if 0'
to find his code snippet. - the local coding conventions disallow
#if 0
and possibly enforce this rule with a script. The programmer found a contorted workaround. - some programmer's editors (eg
vim
) colorize#if 0
sections as comments, using a different preprocessor expression defeats this. - the programmer might have thought a boolean expression was required after
#if
. The use of parentheses supports this explanation, but only the programmer can tell. - the original code had
#if (OPTION > 1)
andOPTION
was changed to1
with ased
script or some other global text replacement method. - the programmer may have wanted to attract the next reader's attention. Either for a humorous purpose or some other obscure goal. Goal achieved in this case.
- as noted in some of the comments, this could be a lame attempt at obfuscating the code, to increase job security... For this purpose, I suggest the gets operator:
#if (0 <- 1)
or the crawling adder:#if (1 <~~ 1)
.
I think the the (1 > 1)
acts as a comment for the reader. It is a smiley or some other emoticon! :-)
It would also have been possible to write (0>0)
or similar.