goto/forth

Moshe Eliovson eliovson at aecom.UUCP
Wed Mar 6 08:12:41 AEST 1985


> > Technically it is illegal to assign `a=b', altho some compilers allow 
> > it. I read the release notes of a C compiler (pwb?) by dmr wondering
> > why a label could be passed to as an argument. It seemed to be 
> > interpreted as a funxion ptr. Try using setjmp/longjmp to do this.
> 
> setjmp/longjmp are slow, and they have the (in this case undesirable)
> side effect of re-storing automatic variables. When I was faced with
> the problem in a LISP interpreter, I came up with:
> 
> #define transfer(f)	return(fun)f
> 
> fun next();
> 
> fun start()
> {
> 	transfer(next);
> }
> 
> eval()
> {
> 	register fun kont=start;
> 
> 	while(kont) kont=(fun)(*kont)();
> }
> 
> 						Thomas.

	How does this simulate 'a=b'?  Could you please explain
	what this code is meant to do and how it achieves it?

	Moshe Eliovson
	philabs!aecom!eliovson



More information about the Comp.lang.c mailing list