are enums integers in ANSI?

Henry Spencer henry at utzoo.uucp
Fri Nov 25 03:33:58 AEST 1988


In article <2005 at vedge.UUCP> lai at 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 at zoo.toronto.edu



More information about the Comp.std.c mailing list