In C, integer character constants have the type int
, not char
. So
char version_text[64U] = { '\0' };
and
char version_text[64U] = { 0 };
are completely equivalent (and that is independent of the signedness of char
). Both provide an int
constant as the sole initialiser.
That the MISRA checker complains about the first, but not the second is just an inconsistency.
However, it is probably due to the fact that a zero-initialisation is customarily done by providing just one 0
, while using integer character constants is usually only done for non-zero initialisations - where MISRA expects initialisers for all elements, if I interpret the message correctly, and the checker just doesn't look inside the character constant.