How many values in an enum (Was: Enumerated types... what's the point?)

Brian Matthews 6sigma2 at polari.UUCP
Fri Mar 30 04:17:36 AEST 1990


In article <96 at motto.UUCP> dave at motto.UUCP (David Brown) writes:
|In article <1425 at polari.UUCP> blm at 6sceng.UUCP (Brian Matthews) writes:
|>ANSI enums, on the other hand, are
|>little more than fancy #defines (although you can: a - insert new ones in the
|>middle without renumbering the others by hand and b - have the compiler tell
|>you how many there are.)
|How do you get the compiler to tell you how many values an enumerated
|type has?  Does this just refer to defining a final value, like
|enum days_of_week = {SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
|		     THURSDAY, FRIDAY, SATURDAY, N_DAYS_OF_WEEK };

That's all I meant.  If there is something more subtle, I don't know
about it.
-- 
Brian L. Matthews	blm at 6sceng.UUCP



More information about the Comp.lang.c mailing list