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

Re: Are Goto's in the Linux Kernel necessarily bad?



On Sat, Feb 15, 2003 at 12:49:43AM -0600, Jonathan Drews wrote:
> I have heard that there are many goto statements in the Linux kernel. 
> The accepted convention is that goto statements are a source of 
> programming errors and therefore inherently bad. Is this true and will 
> the use of these goto statements make the Linux kernel  unstable? 

This comes up every few months on the linux-kernel list...

Despite what CS professors say, the use of goto is not necessarily a
bad thing.  Linus tends to have a lot to say about this...  Google
found me a couple of his posts:

    http://www.uwsg.iu.edu/hypermail/linux/kernel/9709.1/0331.html
    http://www.uwsg.iu.edu/hypermail/linux/kernel/9507/0475.html

And what makes the Linux kernel unstable 99.9% of the time is
hardware.  No amount of good programming practice helps when some
piece of hardware does something it isn't supposed to do (or doesn't
do something it *is* supposed to do).

Seriously, I think if you start looking at kernel code, any use of
goto will be for fairly obvious reasons.

Steve
-- 
steve@silug.org           | Southern Illinois Linux Users Group
(618)398-7360             | See web site for meeting details.
Steven Pritchard          | http://www.silug.org/

-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.