Re: patch for 2.1.55 pre-1 minix/sysv/affs

Kai Henningsen (kai@khms.westfalen.de)
18 Sep 1997 10:06:00 +0200


torvalds@transmeta.com (Linus Torvalds) wrote on 12.09.97 in <Pine.LNX.3.95.970912123441.322B-100000@penguin.transmeta.com>:

> On Fri, 12 Sep 1997, Manong Dibos wrote:
> >
> > Perhaps if C had good exception handling throw(), try{}, catch(){}, all
> > this farting around with if()'s could be made a lot more streamlined...
> > Just throw an exception at the first hint of a deviation from the "norm".
>
> Sure. We'd also be about 500 times slower.
>
> Exception handling is _complex_. That translates into slow.

That depends on what you use them for, and how good your optimizer is.
(And of course on how they are defined in the first place.)

True, if they'd be anything like C++ exceptions ... :-(

> The thing that gave "goto" a bad name was irrational computer scientists,
> not any technical reason.

The thing that gave "goto" a bad name was misuse by programmers. CS people
only got irrational about that after the fact.

> Anybody weaned on Pascal hates goto's for a good reason, but that reason
> is not the goto itself, but the stupidity of Pascal. (I'd like to say that
> there are extensions of Pascal that are quite usable, and I just despite
> the basic language itself, not things like TurboPascal).

Actually, I've cut my first "high-level" language teeth on BASIC, and
that's why *I* hate goto's. That doesn't mean I never use them these days,
where they are _useful_.

Goto's are dangerous. They make creating unmaintainable source really
easy. That doesn't mean you can't write good code with goto's. But you
have to know what you are doing.

So I partly agree with Wirth - start people on a language where using
goto's doesn't come naturally, but something like them is still possible.
I just don't agree that silly numbering schemes will do that. On the other
hand, needing to declare the labels was not a bad idea, both for better
documentation and for getting people to think a little more before using
these buggers.

> Actually, I suspect that what made goto's impopular among some computer
> scientists was not the code itself, but the bad compilers of the day. They
> just blamed it on "spagetti code". But take it from me: it's a damn lot
> easier to create bad code by overusing "good" features like exceptions and
> overloading than it is by using "goto".

No, that I won't "take from you". Writing spaghetti code with goto's is
indeed dangerously easy. People who don't know better do it all the time.

Even after learning (UCSD-)Pascal and other "nice" languages, for a long
time, whenever I sat down to Basic I created truely awful spaghetti. Bad
habits are hard to unlearn. And no bad habits are easier to learn than
goto misuse.

It's not that programmers should be prevented from using goto's. It's that
they should be made to think if doing it that way really is a good idea.

MfG Kai