"goto considered harmful" is like all generalizations, a generalization
:-)
All good programmers (for the correct definition of good :-) know when
to use a goto and how to avoid it at all other times. The problem is
that it's hard to start your programming career as a good programmer so
simple rules are developed to help improve programming style. Rules
such as
1) If a routine is more than a page long (132x60?) then you should
split it up into two or more procedures - this addresses complexity for
new programmers
2) Make variable names descriptive - this keeps the RSI levels up.
3) Add lots of comments - more of 2!
4) Don't use gotos
etc.
Now I did a lot of programming in BLISS-10 and there are no gotos to
use even when you really, really need them. This changed my programming
style so much that when I learnt Python earlier this year I didn't
realize there was no goto to use either - I hadn't needed to use on.
Once you have spent time writing structured programs then you can write
good assembler code that doesn't look like spaghetti though dinner
tonight doesn't look like code either!
I blame BASIC (and to a lesser extent FOCAL) for having line numbers on
each line which tends to bredd programs and programmers who use gotos
far too frequently.
Huw Davies | e-mail: Huw.Davies at kerberos.davies.net.au
Melbourne | "If soccer was meant to be played in the
Australia | air, the sky would be painted green"