Skip to main content

IAR Embedded Workbench for RL78 5.20

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

lowmedium.png
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; 
}