Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!husc6!m2c!umvlsi!chittamu From: chittamu@umvlsi.ecs.umass.edu (Satish Kumar .C) Newsgroups: comp.lang.c Subject: Re: problems/risks due to programming language Message-ID: <751@umvlsi.ecs.umass.edu> Date: 26 Feb 90 22:05:25 GMT References: <1597@awdprime.UUCP> <8133@hubcap.clemson.edu> <10839@june.cs.washington.edu> Reply-To: chittamu@umvlsi.ecs.umass.edu (Satish Kumar .C) Organization: University of Massachusetts, Amherst Lines: 38 In article <10839@june.cs.washington.edu> machaffi@fred.cs.washington.edu.cs.washington.edu (Scott MacHaffie) writes: >In article <8133@hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu writes: >> common practice to use break statements by the dozen in order to get >switch (x) { > case '0': case '1': ... case '9': > digit(x); > break; >} > >ADA-C: >switch (x) { > case '0': digit(x); > case '1': digit(x); > ... > case '9': digit(x); >} > Scott MacHaffie Give me a break. In Ada, you would actually write it as case x when '0' | '1' | '2' => digit(x) ; end case; I am sure one can come up with a reasonable syntax for the equivalent in "Ada-C". No personal offense intended, but if the only argument you have for C needing breaks on a case is that you need to write only one action, then all I can say is it is positively absurd. -- -Satish. chittamu@cs.umass.edu -- The Theory of Objectivity: E = MC++