I am working with a legacy code and found this:
#if (1 > 1) //define some function #endif
Not sure, how this can be any different from the more typical #if 0
, to comment out the code? Any thoughts?
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:
grep '#if 0'
to find his code snippet.#if 0
and possibly enforce this rule with a script. The programmer found a contorted workaround.vim
) colorize #if 0
sections as comments, using a different preprocessor expression defeats this.#if
. The use of parentheses supports this explanation, but only the programmer can tell.#if (OPTION > 1)
and OPTION
was changed to 1
with a sed
script or some other global text replacement method.#if (0 <- 1)
or the crawling adder: #if (1 <~~ 1)
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With