Code that is executed but does not perform any action, or has an unintended effect, most likely results from a coding error and can result in unexpected behavior. Statements or expressions that have no effect should be identified and removed from code. Most modern compilers can warn about code that has no effect (see MSC00-A. Compile cleanly at high warning levels).
Wiki Markup |
---|
For a related recommendation, please see \[[MSC07-A. Detect and remove dead code]\]. |
Non-Compliant Code Example (assignment)
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
MSC12-A | 1 ( low ) 1 ( | unlikely ) | 2 ( medium ) | P2 | L3 |
Automated Detection
The LDRA tool suite V 7.6.0 is able to detect violations of this recommendation.
...