Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!utfyzx!sq!msb From: msb@sq.UUCP Newsgroups: comp.lang.c Subject: Re: enum - enum ? Message-ID: <1987Jun9.155307.9026@sq.uucp> Date: Tue, 9-Jun-87 15:53:07 EDT Article-I.D.: sq.1987Jun9.155307.9026 Posted: Tue Jun 9 15:53:07 1987 Date-Received: Sat, 13-Jun-87 01:18:31 EDT References: <139@starfire.UUCP> <516@haddock.UUCP> Reply-To: msb@sq.UUCP (Mark Brader) Organization: SoftQuad Inc., Toronto Lines: 18 Checksum: 54293 Summary: Loosely typed enums have their uses Karl Heuer (karl@haddock.ISC.COM.UUCP), replying to another article, writes: > [The current draft standard] says that enums are just ints. More precisely, their values promote to int, the same way that chars do. > >If enums are too strongly typed (what is this, Pascal?) people will > >go back to lists of #defines. > > But if enums are too weakly typed, what's their advantage over ints? Perhaps Karl hasn't ever had to maintain a program that uses a "list of #defines" over 90 elements long, with the #define for the length of the list in a different place from the list itself. *I* have. If the original coder hadn't been defensive and made the length #define a bit longer than the actual list then was, things could have gotten verrrrry awkward... Mark Brader, SoftQuad Inc., Toronto, utzoo!sq!msb #define MSB(type) (~(((unsigned type)-1)>>1))