I\'m inclined to write if statements by using logical negation operator:
if (!p)
some_code();
Some people around me tend to use explicit co
It depends on what p represents.
If p represents a boolean/logical value, then (!p)
seems most appropriate - comparing to "FALSE" is generally discouraged. I don't anticipate this being of much debate.
If p represents a value, like a counter, then (p == 0)
or (0 == p)
seems appropriate. (There is usually a hot debate between the two. I find the first more readable, but the second avoids some very serious bugs.) Aside from which of the two options is better, I don't anticipate this being a debate (as in, it should compare to 0.)
If p represents a pointer, then you have some issues. A competent C++ programmer should know that (!p)
will tell you if it's null or not. However, the idea of the readability of this is a grey area, and I see this being a highly contested debate.