Re^2: gotos (actually: **Apology**)

Art Boyne boyne at hplvly.HP.COM
Thu Apr 21 00:40:37 AEST 1988


I would like to suggest a down-to-earth reason for having
goto's to all of you esoteric computer-science purists:

When faced with multiple occurances of a common section
of code, one has four choices (any others?):
  1) some sort of subroutine,
  2) replicating the code in multiple places,
  3) some type of big, ugly conditional statement to
     bring unite the occurances,
  4) goto.

Subroutine calls are SLOW -->sorry, but we real-world
types have performance constraints, and 68000's don't
come with 100 MHz options.

Replicating code fills ROM -->another constraint not
normally considered by those of you using VM systems.

My own personal opinion is that the conditional statement
may very well be uglier and harder to follow than a goto,
especially if there are a number of ways into the code, 
(eg., error handling).  Besides, the conditional statement
takes time to execute and fills ROM, a double-whammy.

So, what we have left is goto.  Before you flame back, I'm
not advocating the universal usage of goto, but there are
definitely times when it is the right answer to real problems.

As for the suggestion made in another response that assembler
be used - who ever claimed that assembler is more readable/
supportable than C even given gotos??!!

Art Boyne, !hplabs!hplvly!boyne



More information about the Comp.lang.c mailing list