[net.lang.c] what type is enum ?

esg@mtx5a.UUCP (ed gokhman) (10/30/86)

Is enumeration a fundamental or derived type considering
that it always behaves as int according to X3JJ11 ?
It seems to have problems being either one.

henry@utzoo.UUCP (Henry Spencer) (11/01/86)

> Is enumeration a fundamental or derived type considering
> that it always behaves as int according to X3JJ11 ?
> It seems to have problems being either one.

Neither.  In X3J11speak, enum is not a distinct type at all.  It's just a
way of giving names to a bunch of integer constants.  Your compiler might
helpfully (?) provide warning messages unless you treat it strictly as a
distinct type, but that is not an X3J11 requirement.

It is agreed that this is not terribly satisfactory, but then enums never
were terribly satisfactory.  The way existing compilers treat them is best
described as "confused".  Thus X3J11 had to decide between trying to compose
a complete and consistent specification for their current behavior (probably
impossible), making them distinct types a la Pascal (which would break a lot
of existing C code), or simplifying them to named integer constants (less
than elegant, but the only practical approach).  Actually, there was a fourth
choice:  delete them from C altogether, leaving them as a non-standard
extension in some existing compilers.  I gather there was long debate about
the matter (I'm not formally involved with X3J11, so I can't say for sure).
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,decvax,pyramid}!utzoo!henry