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

Linus Torvalds (
Fri, 12 Sep 1997 12:45:30 -0700 (PDT)

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.

There's nothing wrong with "goto"s, especially for handling "error" cases
(ie anything that throws us out of the normal flow of control). Using an
explicit goto is often clearer than trying to hide things behind "pretty"
constructs, and it's almost always a lot faster.

The thing that gave "goto" a bad name was irrational computer scientists,
not any technical reason. The worst example of this is Pascal, also known
as "The Truly Bad Programming Language Of All Time".

Wirth decided that goto's are bad, so they have to use this stupid
numbering scheme. Yes, of COURSE goto's are bad if they have these
irrational "numbers" attached to them that make no sense. But well
implemented goto constructs allow sane naming and thus much clearer code.

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 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".

Linus "Pascal and Ada considered harmful" Torvalds