Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.lang.c Subject: Re: Re: Breaking out of several nested loops Message-ID: <4450@utzoo.UUCP> Date: Sat, 13-Oct-84 18:55:24 EDT Article-I.D.: utzoo.4450 Posted: Sat Oct 13 18:55:24 1984 Date-Received: Sat, 13-Oct-84 18:55:24 EDT References: <129@ssc-vax.UUCP>, <880@opus.UUCP> Organization: U of Toronto Zoology Lines: 23 > ...and the parent article suggests ripping this nest out into a separate > procedure which has, as parameters, all of the variables needed in the nest > of control constructs--this allows replacing the "goto" with a "return". > I guess the trailing-line-eater bug got the parent article, 'cause there > wasn't a ":-)" at the end. > > I'm sure glad to see that someone would violate all concepts of modularity > (yanking part of the innards out of a procedure), clean interface (defining > a new procedure without regard to how many parameters might be needed), > and, dare I say the word, efficiency. ... Gee, I've always found that modularity and clean interface were *improved* by breaking the innards out into a separate function any time they start getting non-trivial. As an accidental side effect of this, "return" then suffices for multi-level exits. And it's never produced any efficiency problems in my stuff. Efficiency is the standard excuse for ugliness, and that's usually all it is: an excuse. Note that I am not suggesting that you can retrofit this approach into existing code without rethinking said code to make it clean and modular. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry