X3J11: Why no labelled loops?

Chris Torek chris at mimsy.UUCP
Mon Mar 9 06:44:48 AEST 1987

:In article <545 at mntgfx.MENTOR.COM>, franka at mntgfx.MENTOR.COM (Frank A. Adrian) writes:
:>[Jump tables] would be useful in writing threaded code interpreters
:>and in doing high performance code.

In article <674 at elrond.UUCP>, adb at elrond.UUCP (Alan D. Brunelle) writes:
>Would it not be better to use what C already offers? How about implementing
>this with routines rather than goto's? 

This may be unacceptably slow.

>If you declare an array of pointers to functions, then when you have
>your byte_code then:
>will do exactly what your want with the added overhead of a procedure
>call. (DON'T flame me on the syntax - look it up....)

And look it up again!  It is (*table[code])(param).  If function
call overhead is not a problem, this works very well for driving
state transition based actions too.
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris at mimsy.umd.edu

More information about the Comp.lang.c mailing list