Versions Compared

Key

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

...

The expression a < b < c evaluates to true rather than false, as its author probably intended, to false, and the expression a == b == c evaluates to false rather than true, as its author probably intended, to true.

Compliant Solution

Treat relational and equality operators as if it were invalid to chain them.

...

Tool

Version

Checker

Description

GCC

Include Page
GCC_V
GCC_V

 

Option -Wparentheses warns if a comparison like x<=y<=z appears. This warning is also enabled by -Wall.

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

exprprns

Fully implemented.

PRQA QA-C
Include Page
PRQA_V
PRQA_V

3392
3401
4111
4112
4113

Fully implemented.

Related Guidelines

...

Bibliography

...

]Section 6.5.8 "Relational

...

Operators"

...