Is there any good reason to do if(SomeFunction() == true) instead of doing if(SomeFunction())
Not.
If SomeFunction() returns a result of type _Bool , then the equality comparison should be reliable (assuming that evaluating the result is not related to undefined behavior). But using TRUE , not TRUE , and a type name of BOOLEAN , not _Bool or bool , suggests that the result is not the actual _Bool (available only on C99 or newer) but some ad-hoc type of type Boolean - perhaps an alias for int .
A value of any scalar type can be used as a condition in an if . If the value is zero, the condition is false; otherwise the condition is true. If TRUE defined as 1 , and SomeFunction() returns, say, 3 , then the test will fail.
Record
if (SomeFunction()) { }
is simpler, more understandable, and more likely to behave correctly.
Note, for example, that the functions isdigit() et al, declared in <ctype.h> , do not just return 0 or 1 ; if the argument is a digit, isdigit() can (and does) return any nonzero value. The code that uses it is expected to handle it correctly - not comparing it to 1 , TRUE or TRUE .
Having said that, there may be good reason to compare something for equality with TRUE - if it matters whether the result is TRUE or has another non-zero value. But in this case, using the names BOOLEAN and TRUE is misleading. The whole point of the Boolean type is that the values are either true or false; there is no “maybe”, and if there were no different ideas about the truth, it doesn’t matter which one you have.
The recommendation I am trying to implement is as follows:
Never compare a boolean for equality or inequality with TRUE or false (or 0 , 1 , false , TRUE ). Just check the value directly with the operator ! if you want to invert the test. (The “logical logical” value is of type _Bool or is intended to distinguish truth and falsity without additional information. The latter may be necessary if _Bool not available.) Comparison with false may be, but there is no reason for this; comparing the value directly is still clearer.
And if someone tells you that
if (SomeFunction() == true)
better than
if (SomeFunction())
just ask them why
if ((SomeFunction() == true) == true)
not better.
See also section 9 of the comp.lang.c FAQ . His emphasis on C99 preliminary solutions may be a bit outdated, but he is still valid.