Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site mit-eddie.MIT.EDU Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!barmar From: barmar@mit-eddie.MIT.EDU (Barry Margolin) Newsgroups: net.lang.c Subject: Re: A good use of a bad feature Message-ID: <1853@mit-eddie.MIT.EDU> Date: Sun, 4-May-86 02:48:32 EDT Article-I.D.: mit-eddi.1853 Posted: Sun May 4 02:48:32 1986 Date-Received: Tue, 6-May-86 04:06:39 EDT References: <1298@umcp-cs.UUCP> Reply-To: barmar@mit-eddie.UUCP (Barry Margolin) Organization: MIT, EE/CS Computer Facilities, Cambridge, MA Lines: 19 Keywords: case statement, tacky programs In article <1298@umcp-cs.UUCP> jim@umcp-cs.UUCP (Jim Williams) writes: >... the fall through case statement is among the least >defensible of C's features. The only defense I can think of it is that it is more easily transformed into the non-fall-thru version than the other way around. All you have to do is add lots of "break" statements. If you want the effect of the fall-thru style in a language that only executes one case, you must either duplicate code or use lots of gotos in many cases. Note that this would not be so for your "12 Days of Christmas" program, because it could easily be implemented as a for loop that invoked each appropriate case in turn. But in the cases where the alternatives are not indexed so nicely it would not work. However, I agree with you that it is not really a necesary feature. -- Barry Margolin ARPA: barmar@MIT-Multics UUCP: ..!genrad!mit-eddie!barmar