Article View: comp.lang.misc
Article #4380Re: GOTO controversy
From: John Noland
Date: Thu, 07 Mar 1996 21:23
Date: Thu, 07 Mar 1996 21:23
22 lines
1551 bytes
1551 bytes
In article <wallaceDnvoEo.7L7@netcom.com>, wallace@netcom.com says... > >Ok, I'll bite: why is a subroutine with multiple gotos to a single exit point >a "lot" easier to maintain than that same routine with multiple returns? > >The only maintenance tasks that I can see that get any easier are inserting >special-purpose cleanup code that must run before a given function returns >(regardless of why it is returning) This was what I had in mind when I wrote that. I probably should have provided an example and said that in THIS particular situation a goto to a single exit point is much preferable to multiple return statements. I did a grep on all of my C source files for the accounting system I work on and found only 3 goto's in 250,000+ lines of code. So, if you were to take these guidelines as hard and fast rules as to when to USE goto, well, then, I obviously don't follow them very well myself. Sorry all, in retrospect I didn't do very well in presenting my views. Please forgive me! -John
Technical Details
Message-ID:
<4hnk3m$jbb@newshost.cyberramp.net>Path:
arc1-ca.pugleaf.net!newshost.cyberramp.net!newsReferences:
<rcshlds.1.000A6705@mailserv.mta.ca> <Dn8pJ8.nqs@emi.net> <4grt4e$8fg@goanna.cs.rmit.EDU.AU> <4hl8mt$4po@newshost.cyberramp.net> <wallaceDnvoEo.7L7@netcom.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!newshost.cyberramp.net!news From: sinan@cyberramp.net (John Noland) Newsgroups: comp.lang.misc,comp.lang.c,comp.lang.pl1 Subject: Re: GOTO controversy Date: 7 Mar 1996 21:23:02 GMT Organization: Prose Software Message-ID: <4hnk3m$jbb@newshost.cyberramp.net> References: <rcshlds.1.000A6705@mailserv.mta.ca> <Dn8pJ8.nqs@emi.net> <4grt4e$8fg@goanna.cs.rmit.EDU.AU> <4hl8mt$4po@newshost.cyberramp.net> <wallaceDnvoEo.7L7@netcom.com> NNTP-Posting-Host: ramp2-13.cyberramp.net X-Newsreader: WinVN 0.99.5