Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mmintl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!mcnc!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: net.lang.c Subject: Re: mildly obfuscating c Message-ID: <862@mmintl.UUCP> Date: Tue, 10-Dec-85 13:59:08 EST Article-I.D.: mmintl.862 Posted: Tue Dec 10 13:59:08 1985 Date-Received: Mon, 16-Dec-85 05:31:14 EST References: <564@puff.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Distribution: net Organization: Multimate International, E. Hartford, CT Lines: 45 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] >} >------------------------------------------------------------- First, why do you want to do this? The correct way to write this code in c is: switch(whatever) { case 0: /* code */ break; case 1: /* code */ break; /* etc */ } This covers 99.9% of all uses of computed GOTOs. If you have one of the rare applications it doesn't cover, put the GOTO's in the switch statement: switch(whatever) { case 0: goto l1; /* etc */ } Frank Adams ihpn4!philabs!pwa-b!mmintl!franka Multimate International 52 Oakland Ave North E. Hartford, CT 06108