28-09-2017, 10:37 AM
{ 0 } is a MISRA-C 2012 exception, which permits the initialization of the elements of any array to zero.
Initialisating an array of double with { 0.0 } is non-compliant, unless the array has only one element.
Initialisating an array of double with { 0.0 } is non-compliant, unless the array has only one element.
Code:
float64_t array_a[10] = { 0.0 }; // non-compliant
float64_t array_a[10] = { 0 }; // compliant
float64_t array_a[10] = { 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0}; // compliant
Posted by and on behalf of the MISRA C Working Group