Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!asuvax!noao!arizona!dave From: dave@cs.arizona.edu (David P. Schaumann) Newsgroups: comp.lang.c Subject: Re: Enumerated types... what's the point? Keywords: C, enum Message-ID: <161@caslon.cs.arizona.edu> Date: 24 Mar 90 01:04:34 GMT References: <1480@mountn.dec.com> Distribution: usa Organization: U of Arizona CS Dept, Tucson Lines: 33 In article <1480@mountn.dec.com>, wallis@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@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.