MISRAC2012-Rule-2.8_c
In this section:
Synopsis
(Advisory) A project should not contain unused Object definitions.
Enabled by default
No
Severity/Certainty
Low/Medium

Full description
Unused local variable definition.
Coding standards
- MISRA C:2012 Rule-2.8
(Advisory) A project should not contain unused Object definitions
Code examples
The following code example fails the check and will give a warning:
void example(void) {
int unused_var; /* Non-compliant */
}
The following code example passes the check and will not give a warning about this issue:
int example(void) {
int used_var = 2; /* Compliant */
return used_var;
}