Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Initialization of the form { 0 } in relation to Rule 11.9
#2
An exception should be present in rule 11.9 to permit the initialisation of array of pointers with "{0}". This is consistent with rule 9.2 and the exception to rule 10.3 for array of floats.
Code:
float_32 farr_ok1[3] = {0};                 // compliant
float_32 farr_ok2[3] = {0.0f, 0.0f, 0.0f};  // compliant
float_32 farr_nok[3] = {0.0f};              // not compliant with Rule 9.3

int_32 * ptr_ok1[3] = {0};                  // compliant
int_32 * ptr_ok2[3] = {NULL, NULL, NULL};   // compliant
int_32 * ptr_nok[3] = {NULL};               // not compliant with Rule 9.3
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)