Article View: comp.std.c
Article #3406Re: GOTO single exit point (was: Re: How to eliminate GOTO?)
From: Will Rose
Date: Thu, 07 Sep 1995 02:25
Date: Thu, 07 Sep 1995 02:25
28 lines
2120 bytes
2120 bytes
Christopher R. Volpe (volpe@bart.crd.ge.com) wrote: : In article <4258ak$cj7@news0.rain.rg.net>, Paul Long <plong@perf.com> writes: : >volpe@bart.crd.ge.com (Christopher R. Volpe) wrote: : >>In article <41t0sb$15e@news0.rain.rg.net>, Paul Long <plong@perf.com> writes: : >[snip] : > : >I mean the readability problem that Steve McConnell describes in _Code : >Complete_: "It's harder to understand a routine if, reading it at the bottom, : >you're unaware of the possibility that it returned somewhere above." : With all due respect to Mr. McConnell, I don't read code from the bottom up. : >Maybe you misunderstood me. I am _not_ proposing that gotos are a reasonable : >alternative to multiple return statements. Both are bad and avoidable. : Ah... Ok. So you prefer the umpteen-levels-of-if-statement-nesting method? Well, you shouldn't really have to use either; if you are nesting too deep, then that can be as hard to read as a goto. I really didn't understand the goto considered harmful debate - how could you program without gotos? In assembler, I used them all the time. But without any real effort to avoid them, I suppose I've used a couple of gotos in C in the last ten years. I avoid multiple returns as well, except as an immediate abort at the top of a routine. Will cwr@crash.cts.com
Technical Details
Message-ID:
<DEIK1v.9vq@crash.cts.com>Path:
arc1-ca.pugleaf.net!howland.reston.ans.net!usc!crash!cwrReferences:
<3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41iebe$kec@news0.rain.rg.net> <41pm80$skp@inferno.mpx.com.au> <DE02nC.B58@eskimo.com> <41t0sb$15e@news0.rain.rg.net> <DE6G2z.JJD@crdnns.crd.ge.com> <4258ak <42hmj1$96o@rdsunx.crd.ge.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c,comp.lang.c Path: arc1-ca.pugleaf.net!howland.reston.ans.net!usc!crash!cwr From: cwr@crash.cts.com (Will Rose) Subject: Re: GOTO single exit point (was: Re: How to eliminate GOTO?) Organization: CTS Network Services (CTSNET), San Diego, CA Date: Thu, 7 Sep 1995 02:25:06 GMT Message-ID: <DEIK1v.9vq@crash.cts.com> Followup-To: comp.std.c,comp.lang.c X-Newsreader: TIN [version 1.2 PL2] References: <3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41iebe$kec@news0.rain.rg.net> <41pm80$skp@inferno.mpx.com.au> <DE02nC.B58@eskimo.com> <41t0sb$15e@news0.rain.rg.net> <DE6G2z.JJD@crdnns.crd.ge.com> <4258ak <42hmj1$96o@rdsunx.crd.ge.com> Sender: news@crash.cts.com (news subsystem) Nntp-Posting-Host: crash-i2.cts.com