Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC2012-Rule-8.13

In this section:
Synopsis

(Advisory) A pointer should be const-qualified whenever possible.

Enabled by default

No

Severity/Certainty

Low/Medium

lowmedium.png
Full description

A pointer was found that is not const-qualified.

Coding standards
MISRA C:2012 Rule-8.13

(Advisory) A pointer should point to a const-qualified type whenever possible

Code examples

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

int example(int *p) {
  return *p;
}

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

int example(const int *p) {
  return *p;
}