...
Code Block | ||||
---|---|---|---|---|
| ||||
int a = 2; int b = 2; int c = 2; /* ... */ if (a < b < c) /* Misleading,; likely bug */ /* ... */ if (a == b == c) /* Misleading,; likely bug */ |
The expression a < b < c
evaluates to true rather than, as its author probably intended, to false, and the expression a == b == c
evaluates to false rather than, as its author probably intended, to true.
...
Code Block | ||||
---|---|---|---|---|
| ||||
if ( (a < b) && (b < c) ) /* Clearer, and probably what was intended */
/* ... */
if ( (a == b) && (a == c) ) /* Ditto */
|
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
EXP13-C | lowLow | unlikelyUnlikely | mediumMedium | P2 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
| CC2.EXP13 | Fully implemented | |||||||
|
| Option | |||||||
PRQA QA-C |
| 3392 | Fully implemented |
...