Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mmintl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ucbvax!ucdavis!lll-crg!gymble!umcp-cs!seismo!cmcl2!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: net.lang.c Subject: Re: break, continue, return, goto Message-ID: <831@mmintl.UUCP> Date: Tue, 3-Dec-85 13:08:28 EST Article-I.D.: mmintl.831 Posted: Tue Dec 3 13:08:28 1985 Date-Received: Sat, 7-Dec-85 03:19:25 EST References: <771@whuxl.UUCP> <9500029@iuvax.UUCP> <806@whuxl.UUCP> <283@3comvax.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT Lines: 49 [Not food] The real case for imbedded returns is in the following sort of construct: if (a) { stuff; if (b) { more stuff; if (c) { return; /* oops! */ } still more stuff; } even more stuff; } One can deal with "still more stuff" with an 'else if' clause, but "even more stuff" is harder. Basically, one needs a switch: bool ok; if (a) { ok = TRUE; stuff; if (b) { more stuff; if (c) { ok = FALSE; /* oops! */ } else { still more stuff; } } if (ok) { even more stuff; } } Personally, I think this is distincly less readable than the first version. Furthermore, as the complexity of the program flow increases, the amount of overhead to keep track of switches increases; the cost of a return or break does not. There does come a point where it is better to split the parts into separate modules, but I think that point is at about twice the complexity of my example. This leaves lots of intermediate programs where return or break is a clear win. (Raising exceptions is better, but isn't available in c.) Frank Adams ihpn4!philabs!pwa-b!mmintl!franka Multimate International 52 Oakland Ave North E. Hartford, CT 06108