Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!fluke!ssc-vax!dmg From: dmg@ssc-vax.UUCP (David Geary) Newsgroups: comp.lang.c Subject: Re: C enum syntax problem Message-ID: <2623@ssc-vax.UUCP> Date: 25 Apr 89 17:41:25 GMT Organization: Boeing Aerospace Corp., Seattle WA Lines: 41 Krishna writes: : I seem to have some problem in using the enum construct on Sun-3 : m/c. : The following declarations generate an error. : : typedef enum WEEK { : MONDAY, TUESDAY, WEDNESDAY, : THURSDAY, FRIDAY, : SATURDAY, SUNDAY : } ; : typedef enum WEEK_END { : SATURDAY, SUNDAY : } ; : : The error messages are : redeclaration of SATURDAY : redeclaration of SUNDAY : Does it mean that subsets of an enum cannot be defined ? Yes. K&RvII, pg 215: "Enumerations are unique types with values ranging over a set of named constants called enumerators... Enumerator names in the same scope must all be distinct from each other and from ordinary variable names, but the values need not be distinct." : Is this a bug in my C Compiler ? No. : Is there a work around ? Of course ;-) -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ David Geary, Boeing Aerospace, Seattle ~ ~ "I wish I lived where it *only* rains 364 days a year" ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~