From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public From: "Darren New" Subject: Structured programming (Re: Software landmines (was: Why C++ is successful)) Date: 1998/08/20 Message-ID: <6rhpi5$pe7@newshub.atmnet.net>#1/1 X-Deja-AN: 383074750 Content-Transfer-Encoding: 7bit References: <6qfhri$gs7$1@nnrp1.dejanews.com> <35cb8058.645630787@news.ne.mediaone.net> <902934874.2099.0.nnrp-10.c246a717@news.demon.co.uk> <6r1glm$bvh$1@nnrp1.dejanews.com> <6r9f8h$jtm$1@nnrp1.dejanews.com> <6renh8$ga7$1@nnrp1.dejanews.com> <6rf59b$2ud$1@nnrp1.dejanews.com> <35dc6bf4.5328251@news.erols.com> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: First Virtual Holdings Mime-Version: 1.0 Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-08-20T00:00:00+00:00 List-Id: |My point is that 'return' applies a default discipline to 'goto'. In |fact it's so useful that it now becomes OK to use 'return' quite |liberally. This affords much flexibility. Actually, having "return" in the middle of a function can be just as bad or worse than having a goto to the end of a function. The advantage of structured programming is that each construct has one entry and one exit. You can look at while (foo) lotsa stuff } and know just what happens when "foo" turns false. Now, if "lotsa stuff" has goto or return in the middle, you have to read a bunch of code to figure out what happens. You can't just eyeball it and say "Oh, that sorts the list" and ignore it, if somewhere in the bowels of the sort there's a test that returns early when "1/1/2000" is an entry of the list. "break" isn't as bad, as it lands you at the end of the loop as you expect, except that perhaps "foo" isn't false yet. "continue" is only bad if you're actually working *inside* the loop, as you can't add something new to be done unconditionally each time around the loop. And if any of you don't already know this, why are you posting to comp.software-eng? ;-)