Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC++2008-7-1-1

In this section:
Synopsis

(Required) A variable which is not modified shall be const qualified.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

A local variable that is not modified after its initialization is not const qualified.

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( void ){
  int x = 7;
  return x;
}

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

int example( void ){
  int x = 7;
  ++x;
  return x;
}