enums

Walter Bright bright at Data-IO.COM
Tue Jul 26 04:20:25 AEST 1988


In article <8807242307.AA27481 at explorer.dgp.toronto.edu> hugh at dgp.toronto.edu ("D. Hugh Redelmeier") writes:
<In article <1608 at dataio.Data-IO.COM< bright at Data-IO.COM (Walter Bright) writes:
<<From reading the grammar for enums in the Ansi spec, it seems that the
<<following is not allowed:
<<	enum abc { };		/* empty member list	*/
<<	enum def { b, };	/* trailing comma	*/
<<Many compilers accept this, and I've run across code that uses it. Any
<<thoughts? Is this an oversight in the spec?
<This is currently legal in the two compilers I use (the Ritchie
<compiler (the original implementation of enum, so it should carry
<some weight), and System V VAX UNIX PCC).  I do use the feature.

I solved the problem in my compiler by allowing it unless the strict
ANSI switch is thrown. Ah well, more warts!



More information about the Comp.std.c mailing list