[comp.lang.c] GOTO

stuart@bms-at.UUCP (Stuart D. Gathman) (07/30/87)

Structures are superior to goto's for the same reason that assembler is
better than hexadecimal coding.  The assembler automatically computes
addresses and looks up op-codes, tasks that are exceedingly tedious for
human's.  While a goto and label are better than a jump with byte count
or address,  a structure is even better because now the programmer doesn't
even have to worry about the label - another tedious chore has been automated!

Programmers that like using goto's remind me of secretaries that insist on doing
mailing lists by hand because they don't want to learn about mail-merge
or database (it was hard enough trying to get the word processor to do
what they want).

Actually, to me the most welcome feature of modern languages is the 'block'
structure.  How I used to agonize over variable names for "TEMP"!
How many hours I spent tracing execution to find what stomped on the
important variable.  (Especially in BASIC with the 2 character names, groan.)
And yet, certain 'C' programmers I know take delight in declaring all
variables global and carefully orchestrating the code to avoid stomping
on them at the wrong time.  They seem to feel that their careful work
in this regard demonstrates their skill as a programmer.  It is beyond me.
Maybe they should get a job as a compiler.

Back to goto's.  Many gotoer's like to point out that a particular problem
can only be solved with a goto.  One of the assemblers I (am forced to)
use is unable to generate an often used instruction.  Instead, the programmer
must code the instruction in hex.  Does this mean that more instructions
should be coded in hex?  To me anyway, it indicates that the brain-damaged
assembler needs to get fixed!  (But it won't, because it is from IBM.)
(NOTE - This is also why goto's should be kept in 'C': so that we can
kluge around deficiencies in the structures provided.)

If your language can't express a particular construct - you need to extend
it.  I don't mean hack the compiler (although I don't necessarily *not*
mean that), but somehow automate the procedure.  Eg. lex and yacc both
automate code that consists of a big nest of goto's.

In conclusion, my advice is to make the machine do as much of the work
for you as possible.  Don't perform tedious chores out of habit (unless
you find it relaxing).
-- 
Stuart D. Gathman	<stuart@bms-at.uucp>
			<..!seismo!dgis!bms-at!stuart>