Re: Enum?
- Posted by CChris <christian.cuvier at ?gr?culture.gouv.fr> May 15, 2008
- 739 views
gshingles wrote: > > Derek Parnell wrote: > > }}} <eucode> > > enum > > FILE_NO, > > LINE_NO, > > FILE_PTR, > > FILE_START_SYM, > > OP_WARNING, > > OP_TRACE, > > OP_TYPE_CHECK, > > OP_PROFILE_TIME, > > OP_PROFILE_STATEMENT, > > OP_DEFINES, > > minFILE=^, -- first enumeration value > > maxFILE=$ -- last enumeration value > > </eucode> {{{ > > At first I didn't understand it, but after reading other proposals, I like > this > idea the best. > > I was wondering how you would determine the range of an enum from one of its > members > but if I understand what you are proposing, the ^ and $ symbols are valid from > the > start to the end of the enum statement. > > This seems the simplest for a compile-time feature, however > does the entry 'minFILE' count against the value of maxFILE? :) > > ie from your example above: > intent: minFILE = 1, maxFILE = 10 > actual: minFILE = 1, maxFILE = 11 (because of minFILE) > > Maybe you could just store these in constants with ^ and $ available > until the next enum keyword is encountered? They would have to be better > named though because of $ being used for slices. eg enum_start, enum_end, > enum_count ? > > But for the sake of not having to change 50 lines of code to insert a 'record' > in a sequence I'm all for this change regardless. > > Gary Me too. CChris