Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mandrill!gatech!ukma!nrl-cmf!cmcl2!lanl!beta!jlg
From: jlg@beta.lanl.gov (Jim Giles)
Newsgroups: comp.lang.fortran
Subject: Re: Assigned GOTO
Message-ID: <20664@beta.lanl.gov>
Date: 11 Jul 88 18:51:58 GMT
References: <2742@utastro.UUCP> <20008@beta.UUCP> <224@raunvis.UUCP> <12362@mimsy.UUCP>
Organization: Los Alamos National Laboratory
Lines: 25

In article <12362@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes:
> [...]
> You can almost do this with setjmp and longjmp in C.  A better
> way is to do it in assembly:
> 
> 	# jump_to, for vax:
> 		.globl	_jump_to
> 	_jump_to:.word	0
> 		movl	4(ap),12(fp)	# stash new return pc
> 		ret			# and away we go
> 
Think again.  My machine doesn't have any of these mnemonics.  I'm
not even sure what the above code means.  The requirement is for a
PORTABLE way of doing the action.  In this respect, a 'better way'
would be to allow pointers to code, and allow jumps to them (you
already can reference a code pointer for a procedure call).

Note: this doesn't mean that I agree that the original poster had
found a legitimate use of assigned GOTOs.  I would have tried VERY
hard to avoid his solution.  But, if this method was indeed the
most efficient, then assembly is not a good substitute to having
the feature in the language.

J. Giles
Los Alamos