Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hcradm.UUCP Path: utzoo!hcrvax!hcradm!steve From: steve@hcradm.UUCP (Steve Pozgaj) Newsgroups: net.lang.c Subject: Re: mildly obfuscating c Message-ID: <2434@hcradm.UUCP> Date: Mon, 9-Dec-85 20:11:41 EST Article-I.D.: hcradm.2434 Posted: Mon Dec 9 20:11:41 1985 Date-Received: Tue, 10-Dec-85 00:32:03 EST References: <564@puff.UUCP> Reply-To: steve@hcradm.UUCP (Steve Pozgaj) Organization: Human Computing Resources, Toronto Lines: 27 In article <564@puff.UUCP> tom@puff.UUCP writes: >i haven't been able to figure out anyway to "goto" a label that >i don't know. for example, i would like to do this: > >------------------------------------------------------------- >main() { > int (*jump[])() = { l1,l2,l3,l4,l5,l6,l7,l8 } > > l1: /* code */ > l2: /* code */ > l3: /* code */ > l4: /* code */ > l5: /* code */ > l6: /* code */ > l7: /* code */ > l8: /* code */ > > goto *jump[whatever] >} >------------------------------------------------------------- > >aside from the forward-referencing problem of the unseen labels, >this is a still syntax error. anyone have any way to do this? Yes, it's called a "switch" statement, and was designed to obviate the need for people translating Fortran to C and attempting to kludge out a computed goto. A little careful rethought can usually recast computed goto's in a switch.