Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
The gcc way
#define DISPATCH() \
{ goto *op_table[*((stringOfBytecode)++) - 'a']; }
static void interpreter_the_gcc_way(const char* stringOfBytecode) {
static void* op_table[] = {
&&op_a, &&op_b, &&op_c, &&op_d, &&op_e
op_a: printf("Hell"); DISPATCH();
op_b: printf("o"); DISPATCH();
op_c: printf(" w"); DISPATCH();
op_d: printf("rld!\n"); DISPATCH();
op_e: return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment