MISRA C++:2008 Rule 0-1-3
A project shall not contain unused variables
Description
This checker is deactivated in a default Polyspace® as You Code analysis. See Checkers Deactivated in Polyspace as You Code Analysis (Polyspace Access).
Rule Definition
A project shall not contain unused variables.
Rationale
Presence of unused variables indicates that the wrong variable name might be used in the source code. Removing these variables reduces the possibility of the wrong variable being used in further development. Keep padding bits in bitfields unnamed to reduce unused variables in your project.
Polyspace Implementation
Polyspace reports a violation of this rule if:
A local or global variable is declared or defined but not read in any source files of the project.
A member variable of a structure or a class is declared or defined but not read or written in any source files of the project.
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 R2018a