Enumerated types... what's the point?

David P. Schaumann dave at cs.arizona.edu
Sat Mar 24 11:04:34 AEST 1990


In article <1480 at mountn.dec.com>, wallis at labc.dec.com (Barry L. Wallis) writes:
> 
> 
> Is ordering defined on type enum? I have a book on Turbo-C (can't remember the
> title but it's published by Howard Sams) which says that ordering on the
> elements of an enum is undefined. For example, enum { JAN, FEB, MAR } months
> would make the comparison (FEB > JAN) illegal! I don't believe this is reality
> in Turbo-C, but, I'm currently 1700 miles from my PC and library. 
> ---

>From _The_C_Programming_Language_, 2nd edition, section 2.3, p. 39:
	The first name in an enum has value 0, the next 1, and so on, unless
	explicit values are specified.  If not all values are specified,
	unspecified values continue the progression from the last specified
	value...

I don't know what the 1st edition says, but I think that if TC truly claims
what you said, they are definitely in a very grey area, if not out-and-out
wrong.


> Barry L. Wallis			USENET: wallis at labc.dec.com
> Database Consultant		Prodigy (don't laugh): DNMX41A
> U.S. DECtp Resource Center	DECUServe: EISNER::WALLIS (not on the net yet)
> Los Angeles, CA			"No one voted for me, I represent myself"
> ---


Dave Schaumann			| "The really well that is suprising partner in
Dept. of Computer Science	| crime is that a lot and his wife of the
University of Arizona		| lion's feeding time we may be C D effectively
Tucson, AZ			| quite unaware of the fact that we are even
				| doing it."  -Python, on word association.



More information about the Comp.lang.c mailing list