Topic: swf's thread Compatibility of enums with integers


Author: swf@tdat.ElSegundoCA.NCR.COM (Stan Friesen)
Date: Mon, 7 Mar 94 13:47:47 PST
Raw View
In article <2krosl$r8p@usenet.pa.dec.com>, diamond@tkt.dec.com (Norman Diamond) writes:
|> In article <9402251737.AA22677@tdat.ElSegundoCA.NCR.COM> swf@tdat.ElSegundoCA.NCR.COM writes:
|> >One compiler which we have here defines the compatibility of enums as follows:
|> > if the largest enumerator is <= 256, then  unsignedchar
|> > if the largest enumerator is <  2^16, then unsigned int
|> > otherwise       unsigned long
|> >As I read the standard this is perfectly acceptible in a conforming
|> >implementation so long as they document it (which they did).
|>
|> Indeed, the standard's wording permits the choice of unsigned char even for
|>  enum e { x = -5000 };
|> A Defect Report has been submitted, asking many questions about this.
|>
Oops, I meant largest absolute value.

The point here was that this vendor defines the size of the enumerated
type to depend on the range of values it needs to represent, rather than
as a single, invariant, type.

--
swf@elsegundoca.ncr.com  sarima@netcom.com

The peace of God be with you.