Article View: comp.std.c++
Article #444Re: Proposed Enhancement to select/case (yes, I know...)
From: James C Burley
Date: Tue, 04 Sep 1990 08:58
Date: Tue, 04 Sep 1990 08:58
28 lines
2260 bytes
2260 bytes
In article <1990Sep1.224336.22846@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
In article <1990Aug31.134248@ee.ubc.ca> mikeb@salmon.ee.ubc.ca writes:
> case 'A'..'Z': printf ("upper case\n"); break;
Heh heh. What does this do on an EBCDIC machine? Not what you think!
I think if you look at my original posting, you'll see a kind of backhand
mention of this issue (I said something about it not being any more portable
than a switch with a bunch of cases, in fact maybe less portable).
Anyway, in case you missed it, the issue has been "decided". GNU C already
implements such a construct; and it is a widely used compiler. When the
next standard begins "happening", it will be up to the committee (with all
our input) to determine whether ranges (and lists) are useful and simple enough
to add, compared to the costs of any possible lack of portability being
introduced.
Meanwhile, I personally would not use the range feature for the above case
except in some kind of quick&dirty throwaway program. I'm looking to it
more as an elegant way to deal with natural (i.e. portable) ranges that occur
in applications, and cases where the switch (not select, as I'm wont to say
as a Fortran-90 victim) statement and it's case statements are being written
by someone who does not (or should not/doesn't want to) know the values of
#define constants for the cases (presumably kept in an #include file) but
still wants to handle ranges. Nothing wrong with that, I wouldn't think.
James Craig Burley, Software Craftsperson burley@world.std.com
Technical Details
Message-ID:
<BURLEY.90Sep4045814@world.std.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!bloom-beacon!world!burleyReferences:
<BURLEY.90Aug30030645@world.std.com> <1990Aug30.164610.3519@zoo.toronto.edu> <1990Aug31.134248@ee.ubc.ca> <1990Sep1.224336.22846@zoo.toronto.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!bloom-beacon!world!burley From: burley@world.std.com (James C Burley) Newsgroups: comp.std.c++,comp.std.c Subject: Re: Proposed Enhancement to select/case (yes, I know...) Message-ID: <BURLEY.90Sep4045814@world.std.com> Date: 4 Sep 90 08:58:14 GMT References: <BURLEY.90Aug30030645@world.std.com> <1990Aug30.164610.3519@zoo.toronto.edu> <1990Aug31.134248@ee.ubc.ca> <1990Sep1.224336.22846@zoo.toronto.edu> Sender: burley@world.std.com (James C Burley) Organization: The World Lines: 28 In-Reply-To: henry@zoo.toronto.edu's message of 1 Sep 90 22:43:36 GMT