[comp.std.c] comma at end of enumerator-list

timr@labtam.labtam.oz.au (Tim Roper) (07/01/91)

I note in ANSI X3.159-1989 that

	(a) a trailing comma at the end of an enumerator-list is not allowed,
	    as in:
		enum	bletch	{
			foo,
			bar,
		};

	(b) enum tag namespace is the same as that for struct and union tags

I am trying to figure out why I previously thought otherwise.  Of course enums
were not part of K&R1.  I think it may have been the unix v7 C reference
manual that my understanding of enums was based on but I do not have access to
a copy now.  (It also covered struct arguments and returns.)

Can anyone remind me?  Does anyone know if (a) was considered an issue by X3J11
and whether it is mentioned somewhere in the Rationale?

Please note that I am not crusading but simply confused about why I
thought (a) was common usage and (b) was not true.

-Tim.

henry@zoo.toronto.edu (Henry Spencer) (07/01/91)

In article <10756@labtam.labtam.oz.au> timr@labtam.labtam.oz.au (Tim Roper) writes:
>	(a) a trailing comma at the end of an enumerator-list is not allowed,
>...  Does anyone know if (a) was considered an issue by X3J11
>and whether it is mentioned somewhere in the Rationale?

It does not appear to be mentioned.  If memory (of a secondhand report)
serves, the issue was raised but lack of implementation experience weighed
against it, as did dislike for unnecessary complexity in a feature that was
considered only barely worth including in the standard at all.

(You wouldn't know it from the way some people rant about X3J11's "changes"
to the language, but nearly everything in ANSI C existed in at least one
production C compiler already, and X3J11 almost always rejected ideas that
were not backed by implementation experience.)
-- 
Lightweight protocols?  TCP/IP *is*     | Henry Spencer @ U of Toronto Zoology
lightweight already; just look at OSI.  |  henry@zoo.toronto.edu  utzoo!henry

mycroft@kropotki.gnu.ai.mit.edu (Charles Hannum) (07/01/91)

In article <10756@labtam.labtam.oz.au> timr@labtam.labtam.oz.au (Tim Roper) writes:

   (a) a trailing comma at the end of an enumerator-list is not allowed,
       as in:
	   enum	bletch	{
		   foo,
		   bar,
	   };

   Please note that I am not crusading but simply confused about why I
   thought (a) was common usage and (b) was not true.


You've been using Turbo C too much.  B-)