Messages in this thread | | | Date | Fri, 22 Jan 1999 12:01:15 +1100 (EST) | From | Nathan Hand <> | Subject | Re: 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/
| |