...
This noncompliant code example demonstrates how dead code can be introduced into a program [Fortify 062006]:
Code Block | ||
---|---|---|
| ||
public int func(boolean condition) { int x = 0; if (condition) { x = foo(); /* Process x */ return x; } /* ... */ if (x != 0) { /* This code is never executed */ } return x; } |
...
Related Guidelines
ISO/IEC TR 24772:2013 | Unspecified Functionality [BVQ] Likely incorrect expressions [KOA] Dead and Deactivated Code [XYQ] |
[MISRA 04] | Rule 2.4 |
MITRE 07 | CWE ID 561, Dead code |
Bibliography
[Fortify 062006] | Code Quality, "Dead Code" |
[Coverity 07] |
...