Newsgroups: comp.std.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: are enums integers in ANSI? Message-ID: <1988Nov28.215053.3129@utzoo.uucp> Organization: U of Toronto Zoology References: <8457@alice.UUCP> <219@twwells.uucp> Date: Mon, 28 Nov 88 21:50:53 GMT In article <219@twwells.uucp> bill@twwells.UUCP (T. William Wells) writes: >: ... In effect, it is allowed to play the hostile >: adversary, and choose a compatible integral type for this enum other than >: the one you guessed! > >But it does! The standard says that which one it is compatible with >is "implementation defined". That implies that it has to be >documented. Yes, but this is not entirely inconsistent with Dennis's suggestion. It's quite possible for the documentation to say "picks the first type from the following list which can hold the values and is not the one used in any other declaration of this variable: char, int, [...]". Many of the things which are implementation-defined will have to be documented as algorithms, not single choices, and there is nothing which forbids perverse algorithms. >Furthermore, if we accept that the notion, stated in the Rationale, >that "implementation defined" does not extend to failing to translate >the program, applies here, then there has to be at least *one* >declaration that will work. No; what we have here is a situation in which the legality of such a program is implementation-defined. It is not improper to fail to translate an illegal program. -- SunOSish, adj: requiring | Henry Spencer at U of Toronto Zoology 32-bit bug numbers. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu