Am 14.11.2014 15:32, schrieb Love Nystrom:
"if (f != FALSE)" and "if (f)" are exactly 100% the same for the compiler. "if (f)" is nothing but a synonym for "if (f != 0)" and FALSE is 0.
On 2014-11-14 00.41, Alex Ionescu wrote:
Well, it's certainly a valid option, and C++ compilers seem to generateI would much rather see if (f != FALSE) instead of if ( f ).
[abbrev]
Whether it creates a CMP, or an OR or a TEST is all up to the compiler and it will be the same in both cases. If it was not the same, there is something ... well not neccessarily "wrong" but at least very strange with the compiler.
I think both have their pros and cons. So I don't really care.
I expect some people will use the former.
Personally I much prefer the latter.