Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!tkou02.enet.dec.com!jit533!diamond From: diamond@jit533.swstokyo.dec.com (Norman Diamond) Newsgroups: comp.std.c Subject: Re: How soon can `sizeof (tagged_type)' be used? Message-ID: <1991May21.005938.4839@tkou02.enet.dec.com> Date: 21 May 91 00:55:59 GMT References: <5506@lupine.NCD.COM> <1991May20.034617.19896@tkou02.enet.dec.com> Sender: usenet@tkou02.enet.dec.com (USENET News System) Reply-To: diamond@jit533.enet@tkou02.enet.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo Lines: 19 Erik Naggum writes: >| What is "sizeof (enum E)" supposed to return if not the same as >| "sizeof (int)"? Norman Diamond writes: >| sizeof (short), sizeof (long), or sizeof (other_integral_type...) Erik Naggum: >Right. There's a subtle difference between the type of enumerators >and the enumeration type itself. ... the former have type int, while >the enumerated type "shall be compatible with an integer type; the choice >of type is implementation-defined". (Why this is so escapes me.) Variables can be declared with the enumeration type, and their storage requirements are determined accordingly. But enumerators are just constants. The constants 5200 and 'x', for example, have type int, even though they can fit in shorts; but they're just constants and aren't necessarily stored. -- Norman Diamond diamond@tkov50.enet.dec.com If this were the company's opinion, I wouldn't be allowed to post it. Permission is granted to feel this signature, but not to look at it.