Path: utzoo!attcan!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: question about an array of enum Message-ID: <505@taumet.com> Date: 6 Nov 90 17:20:45 GMT References: <9130019@hpavla.AVO.HP.COM> Organization: Taumetric Corporation, San Diego Lines: 18 gary@hpavla.AVO.HP.COM (Gary Jackoway) writes: >I don't think a compiler can make enums smaller than int and be ANSI >compliant, since the standard says that enums are ints. That's not quite what the standard says. It says (3.5.2.2) that the enum identifiers have type int, but that "Each enumerated type shall be compatible with an integer type; the choice of type is implementation-defined." So given: enum color { red, yellow, blue }; The constants red, yellow, and blue each have type int, but you cannot predict the value of sizeof(enum color). It could be anything from sizeof(char) to sizeof(long). -- Steve Clamage, TauMetric Corp, steve@taumet.com