Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: X3J11: Why no labelled loops? Message-ID: <5707@mimsy.UUCP> Date: Sun, 8-Mar-87 15:44:48 EST Article-I.D.: mimsy.5707 Posted: Sun Mar 8 15:44:48 1987 Date-Received: Mon, 9-Mar-87 04:12:28 EST References: <1710@plus5.UUCP> <388@cognos.UUCP> <545@mntgfx.MENTOR.COM> <674@elrond.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 24 :In article <545@mntgfx.MENTOR.COM>, franka@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@elrond.UUCP>, adb@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: > >(*func)[byte_code](params); > >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@mimsy.umd.edu