Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: question about an array of enum Message-ID: <1990Nov7.003126.23445@zoo.toronto.edu> Organization: U of Toronto Zoology References: <9130019@hpavla.AVO.HP.COM> Date: Wed, 7 Nov 90 00:31:26 GMT In article <9130019@hpavla.AVO.HP.COM> 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... No it doesn't. It says that each one is "compatible with an integer type; the choice of type is implementation-defined" and that the *constants* must have values that fit in an int. There is actually no promise, as nearly as I can tell, that an enumerated type is big enough to hold the constants it is declared with! Certainly there is no promise that anything other than those constants will fit. So an implementation could easily decide that `enum { f=0, t=1 }' is represented as `char' rather than `int'. -- "I don't *want* to be normal!" | Henry Spencer at U of Toronto Zoology "Not to worry." | henry@zoo.toronto.edu utzoo!henry