enums

Robert Firth firth at sei.cmu.edu
Wed Aug 3 01:27:14 AEST 1988


In article <218 at quintus.UUCP> ok at 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.)



More information about the Comp.lang.c mailing list