enum implementation

Daniel Elbaum dan at oresoft.uu.net
Thu Jul 27 05:34:28 AEST 1989


In article <396 at opusys.UUCP> rlkd at 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)



More information about the Comp.lang.c mailing list