Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!ig!uwmcsd1!mailrus!uflorida!novavax!proxftl!bill From: bill@proxftl.UUCP (T. William Wells) Newsgroups: comp.lang.c Subject: Re: enums Summary: enums can be chars, and an X3J11 bug? Message-ID: <547@proxftl.UUCP> Date: 28 Jul 88 14:15:28 GMT References: <1608@dataio.Data-IO.COM> <469@m3.mfci.UUCP> <1988Jul22.171612.6225@utzoo.uucp> <5447@ihlpf.ATT.COM> <31416@cca.CCA.COM> Reply-To: bill@proxftl.UUCP (T. William Wells) Organization: Proximity Technology, Ft. Lauderdale Lines: 23 Expires: Sender: Followup-To: Distribution: Keywords: 3.5.2.2: "The identifiers in an enumerator list are declared as constants that have type _int_..." This says that each of the identifiers declared between the braces is an integer constant. Later in the same section: "Each enumerated type shall be compatible with an integer type; the choice of type is implementation-defined." An integer type is a char, all varieties of ints or longs, or an enumerated type (3.1.2.5). Thus the compiler writer is at liberty to store something declared as an enum in whatever size memory is appropriate, and to sign-extend or not as he sees fit. This seems to be a slight bug in the standard, as enumeration types are not required to be able to store the enumeration constants associated with it, nor to sign extend a short negative integer stored in an unsigned char.