In article <87************@benpfaff.org>,
Ben Pfaff <bl*@cs.stanford.eduwrote:
>C99 6.7.8, para 21:
If there are fewer initializers in a brace-enclosed list
than there are elements or members of an aggregate, or fewer
characters in a string literal used to initialize an array
of known size than there are elements in the array, the
remainder of the aggregate shall be initialized implicitly
the same as objects that have static storage duration.
The C89 wording does not have the phrase about characters
in a string literal, but the "intended" behaviour can be deduced
by the example saying that initialization with a string
"is identical to" initialization with the brace-enclosed list
of characters, together with the explicit phrasing about fewer
initializers.
But on the surface, the C89 wording would appear to allow for a
difference between
char month[10] = { "January" };
and
char month[10] = "January";
in that the former is certainly a "brace enclosed list" but the later
is not -- the C89 part about the braces being optional for string
literals does not preclude the possibility of different behaviours
when the braces are or are not present.
--
All is vanity. -- Ecclesiastes