Another form of goto

David Herron, NPR Lover david at ukma.UUCP
Mon Feb 11 09:48:33 AEST 1985


I came up with the following piece of C code the other night.  A friend and
I were talking about ways of writing a generic Forth interpretor in C.
We realized that the register save/restore at procedure call cost a lot
when you have lots of small routines (as in a forth interpretor).  Also,
a large switch statement has expenses of its own.  Then we thought about 
indirect goto's.  et voila:

	main()
	{
		int *a;

	b:
		a = b;
		printf("a = 0x%x\n", a);
	}

(NOTE: This was compiled under 4.2BSD on a -750)

This compiles and runs perfectly.  However, when adding an obvious statement
(namely, "goto *a") it won't let us compile it.  It seems like the compiler
will *almost* let us do this.

What I want to know is, "can this be easily added to the language?",
"Is it a reasonable thing to add?".  Comments anyone?

-- 
-:--:-
David Herron;
		ARPA-> "ukma!david"@ANL-MCS or david%ukma.uucp at anl-mcs.arpa
		UUCP-> {ucbvax,unmvax,boulder,research}!anlams!ukma!david
		UUCP-> {mcvax!qtlon,vax135,mddc}!qusavx!ukma!david
		UUCP-> {A-Large-Portion-of-The-World}!cbosgd!ukma!david

No stupid sayings (I can't think of one).

No stupid disclaimers (Nobody else would claim my statements anyway).



More information about the Comp.lang.c mailing list