C-STYLE (goto?)

karl at haddock karl at haddock
Thu Sep 11 07:33:00 AEST 1986


killer!toma (Tom Armistead) writes:
>In article <3253 at brl-smoke.ARPA>, jeff at isi-vaxa.ARPA writes:
>>[code deleted]
>>Now, I know a lot of people detest this because of the use of goto's, but
>>this seems the nicest way to perform this function.
>
>There is always the use of setjmp and longjmp ...: [code deleted]
>This will accomplish the same thing and possibly not affend the goto haters,

Mother of swapper!  A longjmp is *worse* than a goto.  It's just a goto that
doesn't respect function boundaries!  Anyone who disapproves of goto but
considers longjmp acceptable is objecting to the keyword rather than the
concept ("I know goto is bad because my teacher said so").  (I'm not flaming
Tom; his posting did not imply approval.)

Lest you misunderstand me -- I am not a "goto hater".  There are three valid
uses of goto, one of which is error handling.  Jeff, your program is a good
example of proper goto usage.  Leave it that way, but learn why it's right.

Karl W. Z. Heuer (ima!haddock!karl; karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list