trailing comma inside enum...bug or feature?

Henry Spencer henry at utzoo.uucp
Tue Dec 13 03:42:56 AEST 1988


In article <2174 at vedge.UUCP> lai at vedge.UUCP (David Lai) writes:
>typedef enum  {
	...
>    XtGeometryDone,       /* Request accepted and done. */
>} XtGeometryResult;
>	/* note trailing comma after XtGeometryDone */
>
>elicit no complaints from any of the C compilers I use?

Probably all the C compilers you are using are PCC-derived or attempting
to be PCC-compatible.  In several contexts, the AT&T compilers are willing
to overlook a missing trailing delimiter or accept an extra trailing
separator.  The only place where this looseness actually made it into the
*documentation*, however, was the optional trailing comma in an initializer
list.  X3J11 declined to legitimize it elsewhere, so a strictly conforming
program cannot rely on it (October draft section 1.7), and a conforming
implementation must complain about use of it (2.1.1.3).  Note, however,
that a conforming implementation is not required to refuse to compile it.
-- 
SunOSish, adj:  requiring      |     Henry Spencer at U of Toronto Zoology
32-bit bug numbers.            | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.std.c mailing list