Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!apple!sun-barr!newstop!sun!bitbug From: bitbug@lonewolf.sun.com (James Buster) Newsgroups: comp.lang.c Subject: Re: problems/risks due to programming language Message-ID: Date: 23 Feb 90 06:16:58 GMT References: <1597@awdprime.UUCP> <8133@hubcap.clemson.edu> Sender: news@sun.Eng.Sun.COM Organization: Sun Microsystems Federal, Inc. Lines: 41 In-reply-to: billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu's message of 23 Feb 90 02:24:08 GMT In article <8133@hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu (William Thomas Wolfe, 2847 ) writes: > C's switch statement is badly designed, so badly designed that it is > common practice to use break statements by the dozen in order to get > it to behave reasonably. A more sensible design would give the switch > the semantics of the Ada case statement, thereby saving countless lines > of code through the elimination of all those "break" statements. > > Bill Wolfe, wtwolfe@hubcap.clemson.edu I claim that the possibly erroneous replication of code required by the Ada case statement, e.g. -- in approximate Ada style switch foo is case 5 => statement1; statement2; statement3; case 7 => statement1; statement2; statement3; end as compared too C's switch (foo) { case 5: case 7: statement1; statement2; statement3; } is well worth remembering to put in break statements. -- --------------------------------------------------------------------- James Buster (Domain) bitbug@lonewolf.ebay.sun.com Mad Hacker Extraordinaire (UUCP) ...!sun.com!lonewolf!bitbug ---------------------------------------------------------------------