typedef enum as subset of another enum

Barry Friedman barry at lizard.metaphor.com
Fri Jun 29 08:22:25 AEST 1990


Excuse me if I am being an ignoramus but...

I want to create two enumerated types, one being a subset of the
other, something like this:

typedef enum { a, b, c, d, e } Set;  /* This defines the full set */
typedef enum { b, c, d } SubSet;     /* This is a subset of above */

I wasn't too surprised when my compiler choked on this. Is there a
way to do this in C? I have checked a few books and I haven't seen
anything that hints at a way to do it. Thanks in advance.
========================================================================
Barry_Friedman();   /* "Why stop now, just when I'm hating it?" 
                       - Marvin the Paranoid Android */



More information about the Comp.lang.c mailing list