Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!ugle.unit.no!nuug!ifi!enag From: enag@ifi.uio.no (Erik Naggum) Newsgroups: comp.std.c Subject: Re: How soon can `sizeof (tagged_type)' be used? Message-ID: Date: 20 May 91 16:45:56 GMT References: <5506@lupine.NCD.COM> <1991May20.034617.19896@tkou02.enet.dec.com> Sender: enag@ifi.uio.no (Erik Naggum) Organization: Naggum Software, Oslo, Norway Lines: 23 In-Reply-To: diamond@jit533.swstokyo.dec.com's message of 20 May 91 03: 46:17 GMT 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_which_the_\ | implementation_is_allowed_to_define_even_though_portable_programs_cannot_\ | directly_name_this_type) Right. There's a subtle difference between the type of enumerators and the enumeration type itself. Section 3.5.2.2 of dpANS of 1/11/88 (sorry, I have the proper standard at my office) specifies that 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.) -- Erik Naggum Professional Programmer +47-2-836-863 Naggum Software Electronic Text 0118 OSLO, NORWAY Computer Communications