MISRAC++2008-8-5-2
In this section:
Synopsis
(Required) Braces shall be used to indicate and match the structure in the nonzero initialization of arrays and structures.
Enabled by default
Yes
Severity/Certainty
Medium/Medium

Full description
There are one or more non-zero array initializations that do not exactly match the structure of the array declaration. This check is identical to MISRAC2004-9.2.
Coding standards
- MISRA C:2004 9.2
(Required) Braces shall be used to indicate and match the structure in the non-zero initialization of arrays and structures.
Code examples
The following code example fails the check and will give a warning:
void example(void) {
int y[3][3] = { { 1, 2, 3 }, { 4, 5, 6 } };
}
The following code example passes the check and will not give a warning about this issue:
void example(void) {
int y[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } };
}