Path: utzoo!attcan!uunet!oresoft!dan From: dan@oresoft.uu.net (Daniel Elbaum) Newsgroups: comp.lang.c Subject: Re: enum implementation Keywords: enum, types, char/int Message-ID: <1989Jul26.193428.8509@oresoft.uu.net> Date: 26 Jul 89 19:34:28 GMT References: <396@opusys.UUCP> Reply-To: dan@oresoft.uu.net (Daniel Elbaum) Organization: Oregon Software, Portland, OR Lines: 23 In article <396@opusys.UUCP> rlkd@opusys.UUCP (R.L.K.Dattatri) writes: ... :Recently, while using two different compilers I ran into :a problem with the types if 'enum' constants. One of them treated :the 'enum' constants as 'integer' and the other one stored :them as 'single bytes'... : :Question: What is the standard (ANSI) type of an 'enum' constant? The relevant section of the dpANS of 12/88 is 3.5.2.2. To paraphrase: every enumeration constant must be representable by an int; the enumeration type may be any type compatible with int. This means 'int', 'signed int', or 'unsigned int'. It sounds like one of your compilers is noncompliant. Enums were an early extension to C, so the first edition of K&R doesn't define them. -- The workaday world must remain transparent to those who maintain it if they are to find inspired within them a vision of the history they create. ({uunet,tektronix,reed,sun!nosun,osu-cis,psu-cs}!oresoft!(dan)@oresoft.uu.net)