8.6.a. When evaluating the equality of a variable against a constant, the constant shall always be placed to the left of the equal-to operator (==).


if (NULL == p_object)
    return (ERR_NULL_PTR);

Reasoning: It is always desirable to detect possible typos and as many other coding defects as possible at compile-time. Defect discovery in later phases is not guaranteed and often also more costly. By following this rule, any compiler will reliably detect erroneous attempts to assign (i.e., = instead of ==) a new value to a constant.

Enforcement: Many compilers can be configured to warn about suspicious assignments (i.e., located where comparisons are more typical). However, ultimate responsibility for enforcement of this rule falls to code reviewers.