Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!rpi!crdgw1!crdos1!davidsen From: davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) Newsgroups: comp.lang.c Subject: Re: enum type checking and switches question Message-ID: <1489@crdos1.crd.ge.COM> Date: 26 Oct 89 14:29:49 GMT References: <1116@qip.UUCP> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: GE Corp R&D Center Lines: 22 You have to know the history of enum to understand why it works as poorly as it does. Someone was out of space for #defined values in their preprocessor, and so added enum to get more space in a diferent symbol table. That's why you can use the name of an enum value as if it was an ordanary int, because it was intended to work that way. This was discussed at one of the early meetings of X3J11 (I was on for just over two years) and because of "existing practice" it was agreed that adding a real enum type with range checking, etc, was not practical. enum can add clarity to reading the code, but it missed its chance to allow the compiler to do more runtime checking. Makinging this work in a range checking manner would break a lot of programs, but I wish there was a way. Your compiler is not broken for failing to perform the checks, that's the way it works. -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon