Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2004-17.5

In this section:
Synopsis

(Required) The declaration of objects should contain no more than two levels of pointer indirection.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

One or more declarations of objects were found that contain more than two levels of pointer indirection. This check is identical to MISRAC++2008-5-0-19, MISRAC2012-Rule-18.5, MISRAC++2023-11.3.2.

Coding standards
MISRA C:2012 Rule-18.5

(Advisory) Declarations should contain no more than two levels of pointer nesting

MISRA C++ 2008 5-0-19

(Required) The declaration of objects shall contain no more than two levels of pointer indirection.

MISRA C++ 2023 11.3.2

(Advisory) The declaration of an object should contain no more than two levels of pointer indirection

Code examples

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

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

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

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