{ initializer-list , }
Alan J Rosenthal
flaps at dgp.toronto.edu
Mon Mar 14 13:45:28 AEST 1988
In article <660 at kuling.UUCP> bjornc at kuling.UUCP (Bj|rn Carlsson) writes:
>Why is an optional trailing comma inside the braces after an
>initializer-list allowed?
Ah, this is a very useful thing. Suppose you have something like:
struct thatthing stuff[] = {
{ "squid", 145, 5.2, "fish" },
{ "parsley", 130, 2.5, "vegetable" },
{ "flaps", 556, 2.1, "human" },
{ "C", 11, 0.598, "programming language" },
};
It is _much_ easier to edit a list like this if every line has the same
format, including the trailing comma. It is also somewhat easier to
generate automatically.
>Is it included in the Draft proposed ANSI C?
Yes.
--
If you had eternal life, would you be able to say all the integers?
More information about the Comp.lang.c
mailing list