[linux-elitists] Harmful things according to google.

Alan DuBoff aland@SoftOrchestra.com
Fri Jan 10 09:45:19 PST 2003


On Friday 10 January 2003 09:08, Don Marti wrote:
> begin Alan DuBoff quotation of Fri, Jan 10, 2003 at 08:36:38AM -0800:
> 
> > There are certain cases where a goto works best, and it's hard to dispute 
> > that.
> 
> $ grep -r goto /usr/src/linux | wc -l
>   14693

Don,

The kernel is exactly where you would expect goto to be most effecient. This 
is where you just can't spare any lost cycles, but some of those are in 
documentation, comments, etc... If you look at the label names on some of 
those statements you will see there are many exceptions, such as goto out, 
goto no_context, goto bad_area, goto bad_frame,  goto fail, goto dev_out, 
etc...This should not be surprising as exceptions are probably one of the 
most used implimentation of the goto statement.

This is also another reason you don't see the goto statement in C++ nearly as 
much, since C++ has exceptions implimented and you can throw exceptions even 
when you're nested inside of a logic loop, so it has the same effect, with 
the glory of having a switch statement integrated on the catch.

-- 

Alan DuBoff
Software Orchestration, Inc.
GPG: 1024D/B7A9EBEE 5E00 57CD 5336 5E0B 288B 4126 0D49 0D99 B7A9 EBEE




More information about the linux-elitists mailing list