lkml.org 
[lkml]   [1999]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Structure vs purism ?


On 21 Jan 1999, Harald Wagener wrote:

> Helge Hafting <helge.hafting@daldata.no> writes:
>
> >
> >
> > [...]
> > > Just under 1000 goto's. Some of which are trivial. Goto's to one-liners,
> > > which are easily tidied. Other files are real snakes-nests. Following the
> > > trail of goto's as they double back on themselves is no fun for the brain,
> > > even less so for a CPU, as modern features such as branch prediction are
> > > misused. (Remember the branch prediction tables are a set size, and can
> > > only store results of a few jumps).
> >
> > As far as I know - no branch prediction is invoked for a goto,
> > because the jump is unconditional - and fast.
> >
> > Tidying up is generally a good thing, but make sure you don't
> > ruin any "fast-path" optimizations by doing so.
> > (That's where the common code path is a small place that fits in
> > the cpu cache, while all exceptional cases are treated elsewhere. Goto's
> > might be useful for doing that.
>
> Another thing is that _sometimes_ gotos are an elegant way to impelemt
> transaction protocol lookalikes without too much fuzz...

State machines are far more easily implemented using gotos, and I
expect that this is another valid use for gotos in Linux.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [from the cache]
©2003-2011 Jasper Spaans