Re: any chance of 2.6.0-test*?

Matti Aarnio (matti.aarnio@zmailer.org)
Sun, 12 Jan 2003 23:15:30 +0200


On Sun, Jan 12, 2003 at 02:34:54PM -0500, 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

Bob,

At first, read Documentation/CodingStyle of the kernel.
Then have a look into:

fs/open.c file do_sys_truncate() function.

Explain how you can do that cleanly, understandably, and without
code duplication, or ugly kludges without using those goto ?
(And sticking to coding-style.)

Also take into account, that there the most common execution path
is direct, and exceptions are redirected elsewere.

Original "gotos are evil" comes from days of FORTRAN (and BASIC)
coding, where labels were all numeric, and definitely non-descriptive.
Where nested conditionals didn't exist, etc. Source-code nesting didn't
exist either...

Doing things in moderation will usually produce better code,
than strict sticking into some paradigm or other.

Of course in schools there is definite need for severe whaking of
sense into heads of the young would-be coders. Clean reusable
and maintainable code is _hard_ to produce without any sort of
role-models and rules, especially when kids teach coding for
themselves by looking into other kids code of "look how clever
spaghetti I made" stuff.

When you learn the ropes (rules), and code enough (some years),
you will finally learn where you can relax the rules a bit.
Especially where the rules _must_ be altered to allow some
formerly boo-boo styles.

...
> If I'm misinterpreting the original code, then forgive me.. I just saw
> a goto and gasped. There's always a better option than goto.

Yes there are, but we are coding in C, nor C++ or Java...

> -Rob

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