Newsgroups: comp.os.minix Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: ARITHMETIC ON ENUMS? Message-ID: <1990Sep11.015829.22860@zoo.toronto.edu> Organization: U of Toronto Zoology References: <30007@nigel.ee.udel.edu> Date: Tue, 11 Sep 90 01:58:29 GMT In article <30007@nigel.ee.udel.edu> HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) writes: >Someone told me that my c68 compiler won't do arithmetic on enums >(he complains that he cannot add two enums) >This was made deliberately, I thought enums are symbolic constants, which >make an ordered type. >All kinds of comparisons should be fine with enums, but arithmetic? > >My K&R books says very little about enums (they came later). ANSI C says firmly that enums are a kind of integer. Compilers are entitled to whine about anything they consider dubious, but they must not refuse to compile it. This was a best-compromise minimum-code-breakage solution to a long-standing debate about the nature of enums. If you want to compile ANSI C, you need to fix this. Whether you like ANSI C or not, it has a far more precise definition and far wider acceptance than any other flavor of C. -- TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology OSI: handling yesterday's loads someday| henry@zoo.toronto.edu utzoo!henry