Switch-case made less buggy, now with PATCH!

BCS none at anon.com
Tue Nov 24 18:17:49 PST 2009


Hello Chad,

> Don wrote:
> 
>> I think you've just created the strongest argument AGAINST this
>> feature: that it makes it too hard for machine-generated code.
>> Forget the !: hack. No chance.
>> 
> If that's the strongest argument, then this is cake.  I'll go through
> Phobos and insert goto case's by hand if that's what needs to happen.
> 
> Most of the fallthrough I saw was stuff like this:
> 
> case '1': case '2': case '3':
> case '4': case '5': case '6':
> case '7': case '8': case '9':
> ...etc...
> break;
> Without fallthrough this is easily rewritten as

Without fall through, this doesn't even need to be rewritten as all the labels 
are just alias to the same thing. Even in C# where fall thought (even of 
the "goto case;" type is forbidden, fall thought is defined where there is 
actual code between the labels.





More information about the Digitalmars-d mailing list