enum implementation

Walter Murray walter at hpclwjm.HP.COM
Fri Jul 28 05:37:41 AEST 1989


R.L.K.Dattatri writes:

> Question: What is the standard (ANSI) type of an 'enum' constant?

> [quotes from ANSI and K&R]

>From the rest of your posting, I think you may be confusing the
enumerated type with the type of the enumeration constants.

Consider the declaration:

	enum {red, green, blue} color;

The identifier 'green' is an enumeration constant and is required
to have type int.

The identifier 'color' denotes an object which has enumerated
type.  That type has to be compatible with one of the eight
integer types, and an ANSI-conforming implementation must
document how that type is chosen.

Walter Murray
Not speaking for X3J11
----------------------------------------------------------------------



More information about the Comp.lang.c mailing list