Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cca!mirror!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: enum type Message-ID: <984@haddock.ISC.COM> Date: Fri, 21-Aug-87 12:38:41 EDT Article-I.D.: haddock.984 Posted: Fri Aug 21 12:38:41 1987 Date-Received: Sun, 23-Aug-87 02:05:47 EDT References: <2048@umn-cs.UUCP> Reply-To: karl@haddock.ima.isc.com.UUCP (Karl Heuer) Organization: Interactive Systems, Boston Lines: 21 In article <2048@umn-cs.UUCP> smiller@umn-cs.UUCP (Steven M. Miller) writes: >The compilers on the Sun and on a Honeywell x20 both complain that >the [enum] operands of "++" ... are of incompatible types. >Is there any way to make the above work without a lot of casts? Some compilers are strict about enums, others are lax. Yours seems to be the former. I think you'll need to either change your enums to ints, or use casts. You could hide it with "#define bump(x) (x=(enum color)((int)(x)+1))", if you only have one type of enum to worry about. >I've also found that lint complains heavily about [enums as arguments] That's a well-known lint bug. >By the way does the ANSI C standard do anything new with enums? like >provide succ(), pred(), lower(), and upper() functions that operate >on enum types? It asserts essentially that enums are ints, so you can use "++", "--", etc. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint