Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!necntc!ima!haddock!karl From: karl@haddock.UUCP (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: enum - enum ? Message-ID: <525@haddock.UUCP> Date: Tue, 9-Jun-87 10:02:22 EDT Article-I.D.: haddock.525 Posted: Tue Jun 9 10:02:22 1987 Date-Received: Fri, 12-Jun-87 03:30:19 EDT References: <139@starfire.UUCP> <516@haddock.UUCP> <20540@sun.uucp> Reply-To: karl@haddock.ISC.COM.UUCP (Karl Heuer) Organization: Interactive Systems, Boston Lines: 18 In article <20540@sun.uucp> guy%gorodish@Sun.COM (Guy Harris) writes: >[haddock!karl (Karl Heuer) writes:] >>But if enums are too weakly typed, what's their advantage over ints? > >I hope certain legal but dubious uses of "enum"s will at least generate >warnings even from X3J11-conforming compilers; for example, coercing >something of type "enum foo" to something of type "enum bar". This >might not be as good at catching errors as forbidding those uses, but >at least it means that the use wouldn't pass without comment. Perhaps you're right; the May86 dpANS lists under Common Warnings: "A value is given to an object of an enumeration type other than by assignment of an enumeration constant that is a member of that type." (Which seems unusually strict, as it would produce a warning for some perfectly valid code written under the "strong enum" model.) If this or similar wording appears in the final Draft, I expect people will continue to use enum as they do now. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint