K
Keith Williams
On Tue, 18 Jan 2005 02:45:25 GMT, "Kryten"
[...]
That's a lot of trouble to avoid a couple of GOTOs. I never understood
the anti-GOTO religion.
Someone said that GOTOs were a bad thing and everyone believed him.
I feel that GOTO can be valid in a certain circumstances.
Such as GOTO <special exit point>.
However people will abuse anything they are offered, so
GOTO <valid local jump>
gets used a
GOTO <any place I damn well please anywhere in the entire program>
Given the scope for appalling abuse, it might be wise to recommend very
sparing usage.
I heard of a guy who's immediate boss (the company boss's son) thought all
code should use GOTO almost entirely, and tried to force everyone else to do
so.
I prefer very flat programs controlled by conditional GOTOs (or JMPs,
in assembly) that operate as state machines. After all, not many
computers have curly brackets in their native instruction sets. What
language you use, and how you use it, just depends on how you think.
I prefer to use CASE like statements to implement state machines. The
PL/I Select/when fit me like a glove here. VHDL's CASE is not quite as
powerful, but makes very readable state machines. If it's done right
the implementation of the state machine can be determined at
compile/synthesis time, rather than during design.
Sure. CASE is just a list of GOTOs.
Ok, you can say that about any HLL construct then. The abstraction
reduces errors.