NO

Author Topic: Simulate computed goto in Pelles C  (Read 2257 times)

akko

  • Guest
Simulate computed goto in Pelles C
« on: August 04, 2011, 12:52:22 pm »
Hi
(I know it is not in the standard but...)
has anybody tried to mimick computed gotos in Pelles C by some smart inline assembler macro?
(I want to build a direct threading virtual machine but the classic giant switch seems too slow)

This works in MinGW (and should in MSVC too):

/* oolala.c */
#include <stdio.h>
#include <stdlib.h>

int main(void)
{   int i = 0;
   void *p = &&l_addr;

   printf("oo");
l_addr:
   printf("la");
   if (++i < 2) goto *p;
   return(0);
}