Am 20.11.2014 14:18, schrieb Love Nystrom:
Well... Actually not exactly the same.. ;)
"if (f != FALSE)" requires an explicit comparison with a second operand,
No, it does not. It requries the compiler to generate code that executes
the following statement, when f is not 0. It could even use crazy
contructs of cdq and sbb and other things.
And a sane compiler does not distinguish between 2 things that are
semantically 100% identical, unless it's not capable of recognizing that
it's identical. You can be sure that every compiler knows that if (a)
and if (a != 0) are the same. The proof that these terms are identical
is left as an exercise for the reader.
Most compilers are not completely retarded. For example when you write
"if (x >= 23 && x <= 42) return 1; else return 0;" the compiler
will
usually optimize this into a single unsigned compare and a subtraction,
like sub ecx, 23; cmp ecx, 9; setbe al;