MISRAC2012-Rule-18.7
In this section:
Synopsis
(Required) Flexible array members shall not be declared
Enabled by default
Yes
Severity/Certainty
Medium/Medium

Full description
Flexible array members are declared.
Coding standards
- MISRA C:2012 Rule-18.7
(Required) Flexible array members shall not be declared
Code examples
The following code example fails the check and will give a warning:
struct example {
int size;
int data[];
} example;
void function(void) {
struct example *e;
}
The following code example passes the check and will not give a warning about this issue:
struct example {
int size;
int data[5];
} example;
void function(void) {
struct example *e;
}