[lkml]   [2003]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: any chance of 2.6.0-test*?
On Sun, 12 Jan 2003, Rob Wilkens wrote:

> Linus,
> I'm REALLY opposed to the use of the word "goto" in any code where it's
> not needed. OF course, I'm a linux kernel newbie, so I'm in no position
> to comment
I'm sure Linus can hold his own on this one, but this has become
a FAQ or FSB (Frequently stated bitch).

Programming 101:
All known microprocessors execute instructions called
"op-codes". The logic of program-flow is implemented
by testing condition "flags" and jumping somewhere else,
based upon the condition. These jumps are "GOTOs".

To implement logic, you have three, and only three choices.
You can jump to some code that's earlier in the instruction
stream, you can jump to some code that's later in the
instruction-stream, or you can just keep executing the
current instruction stream.

Assemblers generate op-codes that programmers program.
They are not allowed to change anything a programmer inputs.
For all practical purposes, they simply change programmer-
defined names to processor-specific op-codes.

Compilers have more latitude. Compilers, including 'C' compilers
attempt to convert logic that a programmer defines to op-codes.
Since a compiler needs to generate code that will give the
correct logic, regardless of the previous logic or the following
logic, it is constrained in its code generation capabilities in
a manner that an assembly-language programmer would not necessarily
be. However, an astute programmer can, using the tools provided
by the compiler, including 'goto', cause code-generation in which
the usual case allows the processor to continue executing the
current execution-stream without jumping.

When the processor is forced to jump on a condition, this usually
costs CPU cycles. An astute kernel programmer may spend hours
mucking with a single piece of code trying to make it execute as
fast as possible. When a new-be comes along and complains about
the methods used, he is going to get his feet wet real quickly!

Here is an example of how some junior instructors in college

They just don't get it. When you get to something that's not
true you can't readily "get out". Further, the normal program-
flow ends up with all those "ifs". The above code should be:

if(!...) goto get_out;
if(!...) goto get_out;
if(!...) goto get_out;
{do something()...}

Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:32    [W:0.223 / U:1.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site