Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.UUCP Newsgroups: comp.lang.c Subject: Re: enum Message-ID: <6505@brl-smoke.ARPA> Date: Sat, 3-Oct-87 19:54:57 EDT Article-I.D.: brl-smok.6505 Posted: Sat Oct 3 19:54:57 1987 Date-Received: Sun, 4-Oct-87 07:05:08 EDT References: <1177@laidbak.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 13 In article <1177@laidbak.UUCP> daveb@laidbak.UUCP (Dave Burton) writes: > enum { A, B, C } varA, varB; > printf("varA < varB is %c\n", varA < varB ? 'T' : 'F'); >"enum.c", line 12: illegal comparison of enums For a while, some C compilers attempted to make enums act like a "set" type, and in the absence of ordering (PRED, SUCC operators), inequality comparison was in general ill-defined. ANSI C intends to have enums act much more like integers, the way older C compilers had them, so (I think) the inequality test would work. This may seem a step backward, but there is existing code that depends on int-like behavior from enums.