Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

C defines <, >, <=, and >= to be relational operators, and it defines == and != to be equality operators.

If a for or while statement uses a loop counter, than it is safer to use a relational operator (such as <) to terminate the loop than to use an equality operator (such as !=).

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

...

...

...

...

Sources

 

 ISO/IEC 9899:2011 Section 6.5.8, "Relational operators," and Section 6.5.9, "Equality operators"

...