Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site rochester.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!rochester!quiroz From: quiroz@rochester.UUCP (Cesar Quiroz) Newsgroups: net.lang.c Subject: Re: Re: Breaking out of several nested loops (& ANSI C) Message-ID: <2085@rochester.UUCP> Date: Thu, 11-Oct-84 19:52:55 EDT Article-I.D.: rocheste.2085 Posted: Thu Oct 11 19:52:55 1984 Date-Received: Sat, 13-Oct-84 01:46:07 EDT References: <129@ssc-vax.UUCP>, <1801@pegasus.UUCP> <4886@duke.UUCP> Organization: U. of Rochester, CS Dept. Lines: 56 Minimal editing done in quotes below!_> I may be dense, but I simply cannot see what makes > ... > break label ; > > any more structured'' than > ... > goto end ; > ... > end : ; > I, for one, will not say that one of the constructs is more ''structured'' that the other. Nor I couldn't care less. For the 'structured'/'unstructured' debate usually moves real fast into religious beliefs. What makes me decide for the 'break' style over the 'goto' style is a set of other considerations. To start with, you may agree (so I hope) that the few goto's that are really harmless (or unavoidable) are the ones that take you out from a loop/procedure or some other flow of control commitment into safe code again. Like the one above, which is probably less dangerous than adding flags to check how to get out. (My typing errors increase exponentially with the number of declarations). However, if those are really the only goto's we really want, why bother implementing the whole power of an all purpose 'goto'? To take your own words on this matter: > In addition, the construct above has the advantage that it > looks like it is doing what it is really doing -- that is, the > break label'' version says that it is breaking a loop labellled > label'', which label is at the beginning, but it is effectively > GOING to the END. > Yes, 'break' (or 'exit' or whatever reason may suggest) says what it is doing. And it can do only what it says, no more no less. In addition, 'break' is NOT going to the end. It's going beyond :-) > Don Knuth wrote an article that was pretty good on Structured > Programming With GOTO's that covered all off this sort of > thing, by the way -- I can dig up a formal reference if needed. > Amen brother. Every side seems to have a Holy Book. (And yes, the article is really good -- my copy appears in Raymond Yeh's collection "Current Trends in Programming Methodology", Vol.1, Prentice Hall (1977), but there is a footnote that says that the copyright is by ACM (1974)). But again, best arguments don't use religion. Cesar Augusto Quiroz Gonzalez {allegra|seismo}!rochester!quiroz