About switch case statements...

Don nospam at nospam.com
Tue Nov 17 00:05:48 PST 2009


Derek Parnell wrote:
> On Mon, 16 Nov 2009 14:34:37 +0100, Don wrote:
> 
>> bearophile wrote:
>>> Don:
>>>
>>>> (providing that empty fall-through case statements remain valid; 
>>>> disallowing them would be really annoying).
>>> What's bad about forcing people to write:
>>> case A, B, C:
>>>
>>> Instead of:
>>> case A:
>>> case B:
>>> case C:
>>> ?
>>>
>>> Bye,
>>> bearophile
>> (1) "case A, B, C:" implies a relationship between A, B, and C, which 
>> might not exist. They may have nothing in common.
>> (2) it's an extremely common coding style in C, C++.
>> (3) it's more difficult to read.
> 
> (1)  case A:
>      case B:
>      case C:
>    implies that there is no relationship between A,B, and C, but which
> might actually exist. They may have something common.

Yes, of course! In which situation, you use case A, B, C:
I'm not arguing AGAINST that syntax, which already exists!

Your other two comments aren't worth responding to.




More information about the Digitalmars-d mailing list