typedef enum as subset of another enum

diamond@tkovoa diamond at tkou02.enet.dec.com
Sat Jun 30 13:37:37 AEST 1990


In article <1256 at metaphor.Metaphor.COM> barry at lizard.metaphor.com (Barry Friedman) writes:

>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 */

typedef enum { a, b, c, d, e } Set;  /* This defines the full set and more */
typedef Set SubSet;                  /* This does too                      */
If you want subranges (such as limiting Set to the range a..e, let alone
what you want to do to SubSet), then you have to use another language.
-- 
Norman Diamond, Nihon DEC     diamond at tkou02.enet.dec.com
This is me speaking.  If you want to hear the company speak, you need DECtalk.



More information about the Comp.lang.c mailing list