Jeff Abrahamson on Mon, 31 Jul 2000 09:39:59 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Re: 'goto' in C code


On Fri, Jul 28, 2000 at 11:15:48PM -0400, Kevin Falcone wrote:
> >>>>> "WM" == Walt Mankowski <waltman@netaxs.com> writes:
> 
>   WM> On Fri, Jul 28, 2000 at 07:24:02PM -0400, Earl J. Morris wrote:
>   >> [...] However, if used with care, it can make the code very
>   >> efficient. [...]
> 
>   WM> Grep for "goto" sometime through the Linux source tree.  If
>   WM> Linus uses them, they can't be all bad, right?
> 
> 
> Like Earl said, it can make code efficient.


  "Premature optimization is the root of all evil."

	        -Don Knuth


Don't use goto's for the sake of efficiency until you know (from
profiling) that it's worth it. Really, code becomes much harder to
maintain when it's not well written.

If you've never done it, emerse yourself in a language like lisp or
scheme that has no concept of goto, not even in its socially
acceptable forms ("contine," "next," etc.). You'll discover after a
few weeks that goto is never necessary. That insight will help your
write better code.

If you need a goto, use it. I've been programming for over a decade
and I've never needed a goto.

-- 
 Jeff Abrahamson
 610/270-4845
 abrahj01@molbio.sbphrd.com

 (home is jeff_abrahamson@purple.com)

______________________________________________________________________
Philadelphia Linux Users Group       -       http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion   -   http://lists.phillylinux.org/mail/listinfo/plug