Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC2012-Rule-18.8

In this section:
Synopsis

(Required) Variable-length array types shall not be used

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

There are arrays declared with a variable length.

Coding standards
MISRA C:2012 Rule-18.8

(Required) Variable-length array types shall not be used

Code examples

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

void example(int a) {
  int arr[a];
}

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

void example(int a) {
  int arr[10];
}