Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: enums Message-ID: <1988Jul29.203306.28272@utzoo.uucp> Organization: U of Toronto Zoology References: <1608@dataio.Data-IO.COM> <469@m3.mfci.UUCP> <1988Jul22.171612.6225@utzoo.uucp> <5447@ihlpf.ATT.COM> Date: Fri, 29 Jul 88 20:33:06 GMT In article <5447@ihlpf.ATT.COM> nevin1@ihlpf.UUCP (00704a-Liber,N.J.) writes: >In article <1988Jul22.171612.6225@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >>It does in fact include them, in the simplest and stupidest form possible. > >By saying that the dpANS C version of enums is 'the simplest and stupidest >form possible', you have implied that there are much better forms of enums >around. Could you please enlighten us on to what these might be? Well, I actually meant "stupidest" in the sense of "they didn't try to be clever about it", rather than "I disapprove of what they came up with". The fact is that enums have always occupied a vague never-never land between being a fancy way to declare integer constants and being something akin to Pascal's scalar types. The latter opens up a number of thorny questions like "can you use enums as array subscripts?". X3J11 decided -- in my opinion, wisely -- not to try to solve these problems. They also decided that enums were in sufficiently common use that deleting them entirely is not practical. So they opted to make them a way to declare integer constants and (sort of) integer subtypes. This sacrifices the error checking possible with more Pascalish semantics, but gets clear, simple, consistent semantics (definitely lacking for enums before) without adding unproven inventions to the language. -- MSDOS is not dead, it just | Henry Spencer at U of Toronto Zoology smells that way. | uunet!mnetor!utzoo!henry henry@zoo.toronto.edu