Re: Question regarding bizarre ','

david carlton
2002-08-06T23:44:57Z

On Tue, 6 Aug 2002 16:14:58 -0700, Kevin Buettner <kevinb@redhat.com> said:

> I am unable to find anything in Harbison and Steele which indicates
> that a trailing comma is acceptable in an array initializer. (They
> don't seem to mention it one way or another.)

K&R (second edition, of course) section A8.7 says:

The initializer is preceded by =, and is either an expression, or a
list of initializers nested in braces. A list may end with a comma,
a nicety for neat formatting.

It seems to be talking about a general enough context to include
arrays and structs, though it's not _entirely_ clear to me; the second
example on the top of p. 220 is an array with an extra comma at the
end.

David Carlton
carlton@math.stanford.edu