enum, no trailing comma?

Richard Minner rtm at christmas.UUCP
Sat Aug 18 04:35:58 AEST 1990


Is it just my eyes or does:

(From December 7, 1988 DRAFT)
3.5.2.2 Enumeration specifiers

Syntax
	<enum-specifier>:
		enum <identifier>_opt { <enumerator-list> }
		enum <identifier>

	<enumerator-list>:
		<enumerator>
		<enumerator-list>, <enumerator>

	<enumerator>:
		<enumeration-constant>
		<enumeration-constant> = <constant-expression>
		
mean that a trailing comma:
	enum foo { one, two, three, };
is disallowed?

It sure looks that way.  (By the way, there's no way to sneak a
comma onto the end of an <enumeration-constant>.) I've been told
that nothing really changed from Dec 7, 88 to the final version,
but maybe this did, right?  (an aside: is it true that nothing
changed besides unary + ?)

If it really is disallowed, why?  It seems out of place, since
trailing commas are ok in array and struct initializers.  Why so
nitpicky here?  (gcc ignores the trailing comma unless you
specify -pedantic.)  Are compiler vendors likely to consider such
a comma a real live syntax error?  I suppose they have to.
(Maybe it was just too hard to specify the syntax to allow a
trailing comma? :-)

-- 
Richard Minner  || {uunet,sun,well}!island!rtm     (916) 736-1323 ||
                || Island Graphics Corporation     Sacramento, CA ||



More information about the Comp.std.c mailing list