Path: utzoo!attcan!uunet!cs.utexas.edu!yale!cmcl2!phri!marob!cowan From: cowan@marob.masa.com (John Cowan) Newsgroups: comp.std.c++ Subject: Re: Proposed Enhancement to select/case (yes, I know...) Message-ID: <26E3C576.1C9B@marob.masa.com> Date: 4 Sep 90 15:17:10 GMT References: <1420@lupine.NCD.COM> Distribution: comp Organization: ESCC, New York City Lines: 24 In article <1420@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes: >Regarding "case lists", it seems clear that a simple syntax, i.e.: > > case FOO,BAR: > >won't work because the separator comma could be parsed as the normal comma >operator, which would mess up everything. Other posters have also asserted this. I don't see it. K&R2, section A7.19, says "Constant expressions may not contain ... comma operators." Case expressions are constant expressions. Therefore the overloading of commas in a "case list" construction is not ambiguous, although it might confuse humans. Other posters have also pointed out that ranges of characters such as 'A' .. 'Z' are inherently unportable w/r/t character set. This is true, but ranges of enums remain safe and useful, since enums are guaranteed to be assigned values left-to-right increasing by 1. A large enum declaration may be listed in order of logical groups, and then a range could be used to test whether or not a particular enum variable had a range within the group. -- cowan@marob.masa.com (aka ...!hombre!marob!cowan) e'osai ko sarji la lojban