Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!cs.utexas.edu!uunet!oresoft!dan From: dan@oresoft.uu.net (Daniel Elbaum) Newsgroups: comp.lang.c Subject: Re: 'C' enum syntax problem Keywords: enum syntax Message-ID: <673@oresoft.uu.net> Date: 25 Apr 89 17:42:15 GMT References: <1095@cvbnet2.UUCP> Reply-To: dan@oresoft.uu.net (Daniel Elbaum) Distribution: usa Organization: Oregon Software, Portland, OR Lines: 25 In article <1095@cvbnet2.UUCP> krishna@xenon.uucp (Temporary) writes: >I seem to have some problem in using the enum construct on Sun-3 >The following declarations generate an error. > > typedef enum WEEK { MONDAY, TUESDAY, SATURDAY, SUNDAY }; > typedef enum WEEK_END { SATURDAY, SUNDAY }; > The identifiers of the enum are, in effect, integral constants. You can use MONDAY, TUESDAY, etc. as though they were manifest constants, assign them to int's (casting may be necessary), and just generally go wild. Because of this, the names of the constants may not be reused in the same scope. You might try something like this: enum WEEK { MONDAY, TUESDAY, SATURDAY, SUNDAY }; enum WEEK_END { Saturday = SATURDAY, Sunday = SUNDAY }; unless, of course, your implementation of C is case-insensitive. -- Not responsible : uunet - for this posting : tektronix \!oresoft!dan : reed / dan@oresoft.uu.net : sun!nosun -