Inside the switch statement
BCS
none at anon.com
Tue Jun 9 09:55:02 PDT 2009
Hello grauzone,
> BCS wrote:
>
>> Hello grauzone,
>>
>>>> http://groups.google.com/group/net.lang.c/msg/66008138e07aa94c
>>>>
>>> Many people (even Brian Kernighan?) have said that the worst feature
>>> of C is that switches don't break automatically before each case
>>> label.
>>>
>>> Oh god, that's from 1984, and even today we're struggling with this
>>> bullshit in the most modern dialect of C, D.
>>>
>> I'm sorry, you don't have my sympathy on this one. There are to many
>> place I've used fall throught to chuck it out.
>>
> What kind of fall-throughs were these?
>
> A:
>
> case value1:
> case value2:
> case valueN:
> code1();
> break;
I don't do that, I go with this form:
case value1, value2, valueN:
code1();
break;
case B, The most usefull case was where I used the switch as a "jump into
the middle of this block of code" device.
> B:
>
> case value1:
> code1();
> case value2:
> code2();
> break;
More information about the Digitalmars-d-learn
mailing list