Why is this an issue?
The result of the comparison is the same, regardless of whether the constant is on the left or right-hand side. But following this convention will
help pinpoint the occasional error where
= (assignment) is substituted for
If the constant is on the right-hand side of the expression in such cases, the code will still compile and run - just not as expected. If the
constant is on the left-hand side, the error will be caught at the first attempt to compile.
Noncompliant code example
if ( var == constant )
if ( pointer == NULL )
if ( constant == var )
if ( NULL == pointer )