MISRA C++:2008 Rule 0-1-9
There shall be no dead code
Description
Rule Definition
There shall be no dead code.
Rationale
If an operation is reachable but removing the operation does not affect program behavior, the operation constitutes dead code. For instance, suppose that a variable is never read following a write operation. The write operation is redundant.
The presence of dead code can indicate an error in the program logic. Because a compiler can remove dead code, its presence can cause confusion for code reviewers.
Polyspace Implementation
Polyspace® reports violation of this rule on statements that have no effect on the code, such as writing a value to a variable that is not used subsequently.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Language Independent Issues |
Category: Required |
Version History
Introduced in R2016b