Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC++2023-11.6.1 (C++ only)

In this section:
Synopsis

(Advisory) All variables should be initialized

Enabled by default

No

Severity/Certainty

Low/High

lowhigh.png
Full description

Variables should be explicitly initialized with an associated initializer in their definition. Exceptions are variables that are implicitly zero initialized (static), class type variables and function parameters.

Coding standards

This check does not correspond to any coding standard rules.

Code examples

The following code example fails the check and will give a warning:

int example(int n) {
  int i;           // Non-compliant
  i = n + 1;
  return i;
}

The following code example passes the check and will not give a warning about this issue:

int example(int n) {
  int i = n + 1;   // Compliant
  return i;
}