Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!itivax!vax3.iti.org!scs From: scs@vax3.iti.org (Steve Simmons) Newsgroups: comp.lang.c++ Subject: Re: stronger type checking of enums Message-ID: <739@itivax.iti.org> Date: 8 Mar 89 20:56:42 GMT References: <25740@cornell.UUCP> <36748@bbn.COM> Sender: news@itivax.iti.org Reply-To: scs@vax3.iti.org (Steve Simmons) Organization: Industrial Technology Institute Lines: 25 In article <36748@bbn.COM> lpringle@labs-n.bbn.com (Lewis G. Pringle) writes: >In article <25740@cornell.UUCP> deb@cs.cornell.edu (David Baraff) writes: >>I'd like to make a case for stronger type checking of enum's. > >I agree that this would be very nice. But it does introduce some >questions. Array indexing. > >One would probably also want to be able to declare: > enum Color {r,g,b}; > int a[Color]; >[[and goes on to talk about ord() and Pascal]] Enums as presently constructed give one a false sense of security. Aside from such wonderful questions as strong type checking, we have to deal with stupid issues like enum Color { red, green, blue, orange } ; vs. enum Fruit { plum, orange, avocado, kumquat } ; The intent of enum seems to be a primitive user-defined class -- a named type with a list of specific values which it may take. Let's keep enum in it's present form but just tighten up the checking. It looks like a prime case where C++ can improve C without breaking.