Newsgroups: comp.std.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: are enums integers in ANSI? Message-ID: <1988Nov24.173358.13835@utzoo.uucp> Organization: U of Toronto Zoology References: <2005@vedge.UUCP> Date: Thu, 24 Nov 88 17:33:58 GMT In article <2005@vedge.UUCP> lai@vedge.UUCP (David Lai) writes: > Draft Proposed ANSI C and most current implementations mandate > that all enumeration types be treated as integer types... >Does this mean: [examples of promiscuous enumming] >are legal, or are explicit casts necessary? The sun compiler likes >to complain, will ANSI compilers complain? Enums are a fancy way of declaring an integer type and some integer constants. The language (at least as of the May draft, I haven't had the time to study the October draft carefully yet) makes no finer distinctions. Casts are not needed. Compilers are free to complain about most anything they feel like complaining about, and it is quite possible that many compilers will try to help out by producing warning messages about what they consider sloppy use of enums. Murphy being what he is, probably no two such compilers will quite agree on what to complain about... -- Sendmail is a bug, | Henry Spencer at U of Toronto Zoology not a feature. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu