Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!columbia!rutgers!umnd-cs!umn-cs!smiller From: smiller@umn-cs.UUCP (Steven M. Miller) Newsgroups: comp.lang.c Subject: enum type Message-ID: <2048@umn-cs.UUCP> Date: Thu, 20-Aug-87 12:48:08 EDT Article-I.D.: umn-cs.2048 Posted: Thu Aug 20 12:48:08 1987 Date-Received: Sat, 22-Aug-87 12:48:29 EDT Organization: University of Minnesota, Minneapolis Lines: 49 I've never used the enum type in C before and am having some minor struggles with it. I've seen several examples with enum types where the type is used as below. enum color { yellow, green, red }; main() enum color marker; for (marker = yellow ; marker != red ; marker++) { /* some code here */ } } The compilers on the Sun and on a Honeywell x20 both complain that the operands of ++ in the for line are of incompatible types. Is there any way to make the above work without a lot of casts? I've also found that lint complains heavily about the following use of enums. main() { enum color pen; func( &pen ); } func( marker ) enum color *marker; { /* some code here */ } Here lint complains that the the argument to func is used inconsistently. The code runs fine, but why does lint complain? 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?