Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site cbosgd.UUCP Path: utzoo!linus!decvax!microsoft!uw-beaver!cornell!vax135!ariel!hou5f!hou5e!hou5d!hogpc!houxm!ihnp4!cbosgd!mark From: mark@cbosgd.UUCP Newsgroups: net.lang.c Subject: Re: Intelligibility of multibreak loops Message-ID: <229@cbosgd.UUCP> Date: Thu, 25-Aug-83 21:09:32 EDT Article-I.D.: cbosgd.229 Posted: Thu Aug 25 21:09:32 1983 Date-Received: Sat, 27-Aug-83 19:06:18 EDT References: <573@ulysses.UUCP> Organization: Bell Labs, Columbus Lines: 19 Among programming languages people, multi level breaks and continues are generally considered a "good thing". When coupled with a decent for loop (such as the one in C) and a return statement, the almost make goto's completely obsolete. There are two remaining situations I run across every blue moon that are left: (1) Error handling. There are lots of hairy and ugly schemes to deal with sudden errors. Software events, such as PL/1 on-units and Ada exceptions, are one very complex approach. Non local goto's ala Pascal are another. For my money, the setjmp/longjmp mechanism provided by the C library (not the language!) is prefectly adequate for this one, although one would like better diagnostics when you mess up. (2) Reduction to another case. This is a familiar concept in Mathematics, where you handle one case by doing some simplification and then saying "it reduces to this other case". The same thing is useful in programming. Within a switch, you want to say, in effect, "go to the label marking the code to handle the following switch value". (Note this is a generalization of the "goto default" situation mentioned earlier.)