About switch case statements...
    Derek Parnell 
    derek at psych.ward
       
    Mon Nov 16 12:36:38 PST 2009
    
    
  
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.
(2) it's an extremely common writing style in human languages, thus aids
readability.
(3)  case A:
     case B:
     case C:
   is ambiguous. It looks like the coder put in place markers for intended
code but forgot the code.
-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
    
    
More information about the Digitalmars-d
mailing list