switch break

Dave Eisen dkeisen at Gang-of-Four.Stanford.EDU
Thu Oct 4 02:04:03 AEST 1990


In article <11428 at alice.att.com> ark at alice.att.com (Andrew Koenig) writes:
>In article <15611 at csli.Stanford.EDU>, poser at csli.Stanford.EDU (Bill Poser) writes:
>
>> I'm curious about the problem some people apparently have
>> with the fall-through property of switch.
>
>Some people have difficulty understanding things that aren't Politically 
>Correct.


And some of us have problems with unjustified snipes.

I doubt anyone has difficulty understanding the semantics of switch,
they are simple enough. That doesn't mean we agree with them. Any decent
C programmer uses switch correctly every day of eir life, but I doubt
that I am alone in having omitted it by accident once or twice and
having been left with annoying bugs.

We don't want to take away your precious fall-through cases, I'm glad that
option is available too. But the each case separate type of switch
clearly is the more common type, is much easier to follow, and is
more correct politically, err, I mean is more structured. 

Besides, it always seems silly to me to have to write break a dozen
times in a long switch to do what in my mind is the canonical 
operation. Changing the default to breaking and allowing the word
continue to be used for fall-through  where would make switch statements 
cleaner and would save typing in both the fall through and other case --- 
we wouldn't have to type "break;" and we wouldn't have to type
"/* YES --- I REALLY MEAN TO FALL THROUGH */."



--
Dave Eisen                      	    Home: (415) 323-9757
dkeisen at Gang-of-Four.Stanford.EDU           Office: (415) 967-5644
1447 N. Shoreline Blvd.
Mountain View, CA 94043



More information about the Comp.lang.c mailing list