Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!labrea!rutgers!rochester!pt.cs.cmu.edu!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.lang.c Subject: Re: enums Message-ID: <6485@aw.sei.cmu.edu> Date: 2 Aug 88 15:27:14 GMT References: <1608@dataio.Data-IO.COM> <469@m3.mfci.UUCP> <1988Jul22.171612.6225@utzoo.uucp> <5447@ihlpf.ATT.COM> <11686@steinmetz.ge.com> <2404@boulder.Colorado.EDU> <218@quintus.UUCP> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu (Robert Firth) Organization: Carnegie-Mellon University, SEI, Pgh, Pa Lines: 18 In article <218@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes: >:This [wraparound of increment and decrement] >: is like Pascal's succ() and pred() operators. >No it isn't. The Pascal fragment > var: flag: (red, white, blue); > ... > flag := blue; > flag := succ(blue); >is *illegal* and any half-way decent Pascal system will give you a >run-time error if you try it. (It's just the same in Ada.) Quite true. Moreover, any compiler more than half decent will give you a COMPILE TIME warning; the Ada compiler I currently use gives WARNING: assignment must raise RANGE_ERROR which is very helpful. (Note that it can't be an error, since the code could be unreachable.)