...
If expressions that appear to produce side effects are an unevaluated operand, the results may be different than expected. Depending on how this result is used, it can lead to unintended program behavior.
Rule | Severity | LikelihoodRemediation Cost | Detectable | Repairable | Priority | Level |
|---|---|---|---|---|---|---|
EXP52-CPP | Low | Unlikely | Yes | YesLow | P3 | L3 |
Automated Detection
Tool | Version | Checker | Description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| sizeof | Partially checked | |||||||||||
| Axivion Bauhaus Suite |
| CertC++-EXP52 | ||||||||||||
| Clang |
| -Wunevaluated-expression | ||||||||||||
| CodeSonar |
| LANG.STRUCT.SE.SIZEOF | Side Effects in sizeof | |||||||||||
| Helix QAC |
| C++3240, C++3241 | ||||||||||||
| Klocwork |
| MISRA.SIZEOF.SIDE_EFFECT | ||||||||||||
| LDRA tool suite |
| 54 S, 133 S | Partially implemented | |||||||||||
| Parasoft C/C++test |
| CERT_CPP-EXP52-a | The operand of the sizeof operator shall not contain any expression which has side effects | |||||||||||
| Polyspace Bug Finder |
| CERT C++: EXP52-CPP | Checks for logical operator operand with side effects | PRQA QA-C++ | ||||||||||
| Include Page | PRQA QA-C++_V | PRQA QA-C++_V | 3240, 3241||||||||||||
| RuleChecker |
| sizeof | Partially checked |
...