Path: utzoo!mnetor!uunet!husc6!uwvax!oddjob!gargoyle!att-ih!ihnp4!ihlpg!tainter From: tainter@ihlpg.ATT.COM (Tainter) Newsgroups: comp.lang.c Subject: Re: gotos Message-ID: <5170@ihlpg.ATT.COM> Date: 8 Apr 88 23:49:13 GMT References: <2571@cognos.UUCP> <77200029@uiucdcsp> <4307@ihlpf.ATT.COM> <4347@ihlpf.ATT.COM> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 32 In article <4347@ihlpf.ATT.COM>, nevin1@ihlpf.ATT.COM (00704a-Liber) writes: > In article <2556@ttrdc.UUCP> levy@ttrdc.UUCP (Daniel R. Levy) writes: > |I know this battle is an old chestnut, but for the record do you guys believe > |that superfluous flags and great big if-then statements are truly superior > |to the goto? (And the break, which is a goto by another name.) E.g.: > | > | while (loopcond) { > | for (i=0; i | if (frob(i) == TRUE) > | goto loopagain; /* nice and CLEAN!!! */ > | .../* lots and lots of code over many pages */... > |loopagain: ; > | } > Opinion: this is an example of FORTRAN disguised as C. > In this particular case, using a continue statement > inside in your Fortran-type example instead of a goto is much more preferable. Except of course that that wouldn't work since it is nested under a second loop. This is the only alternative to using a flag on the lines of the alternative code. [ Flag riddled code at indentation >> removed ] > Opinion: this is an example of Pascal disguised as C. > _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 People, listen closely, GOTOs are not inherently bad. If used carefully as in this example they are quite reasonable and really not hard to follow. Of course, they would be much harder to understand if they didn't use mnemonics and instead used numbers ala Pascal or ForTran. --j.a.tainter