...
Failing to understand the short-circuit behavior of the logical OR or AND operator may cause unintended program behavior.
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
EXP02-C | Low | Unlikely | Medium | P2 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
Astrée |
| logop-side-effect | Fully checked | ||||||
Compass/ROSE |
Could detect possible violations of this recommendation by reporting expressions with side effects, including function calls, that appear on the right-hand side of an | ||||||||
Klocwork |
| MISRA.LOGIC.SIDEEFF |
LDRA tool suite |
| 35 D | Fully implemented | ||||||
Parasoft C/C++test |
|
|
| MISRA2004-12_4a | Fully implemented | |||||||
PRQA QA-C |
| 3415 | Fully implemented | ||||||
RuleChecker |
| logop-side-effect | Fully checked | ||||||
SonarQube C/C++ Plugin |
| SideEffectInRightHandSideOfLogical |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
SEI CERT C++ Coding Standard | VOID EXP02-CPP. Be aware of the short-circuit behavior of the logical AND and OR operators |
MITRE CWE | CWE-768, Incorrect short circuit evaluation |
...
...