Switch
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon May 18 21:03:56 PDT 2009
Rainer Deyke wrote:
> Georg Wrede wrote:
>> This is usable, easy to read -- and the programmer has no problem to
>> remember that .. works differently in case statements than in ranges.
>
> You're making two assumptions here:
> 1. That inclusive ranges are preferable inside 'case' statements.
Yes. The point of case a: .. case b: is to save you from writing case a:
case a+1: and so on up to case b:. There is no exclusion. You write now
the cases you want to handle.
> 2. That non-inclusive ranges are preferable outside 'case' statements.
Of course. One word: STL.
> I don't buy it. The issue of inclusive versus non-inclusive ranges is
> *exactly the same* in and outside 'case' statements.
No.
Andrei
More information about the Digitalmars-d
mailing list