enums

Frank Swarbrick swarbric at tramp.Colorado.EDU
Sun Jul 31 17:32:54 AEST 1988


In article <11686 at steinmetz.ge.com> davidsen at crdos1.UUCP (bill davidsen) writes:
>Here are my ideas on how an enum should work. Obviously no one gave me
>definitive insight, so consider this as opinion from someone who's been
>using computers for a while. If it looks a lot like Pascal, perhaps
>that portion of the language is more useful than the bulk of it.
>
>- enums should be a sequence of values in increasing order. The values
>  should start at zero and increase by one. This allows the ++ and --
>  operators to be used in a meaningful way.

Personally, I would like it to be even a little more like Pascal.  Let's
say I have

typedef enum {red, white, blue} flag_colors;

I would like:

{
   flag_colors flag;

   flag = blue;
   flag++;
}

to have it so flag is now red.  This is like Pascal's succ() and pred()
operators.

Frank Swarbrick (and, yes, the net.cat)           swarbric at tramp.Colorado.EDU
...!{ncar|nbires}!boulder!tramp!swarbric
"You shouldn't kill your brother -- except if he doesn't know what's right.
 If he can't love your heaven, ahh, it's a mercy for him to die."      --Accept



More information about the Comp.lang.c mailing list