Funny you mention that - I used that structure in my simple virtual machine (which includes a compiler, a decompiler, support for conditionals, and also an example of embedding):
Rather than having an enum of opcodes I have a array of pointers to functions - one for each opcode I implement. It is a logical/clean way of implementing things, but i think it is not necessarily better.
(In my case I lose due to inline strings, and variable length opcodes which make complications.)
https://github.com/skx/simple.vm
Rather than having an enum of opcodes I have a array of pointers to functions - one for each opcode I implement. It is a logical/clean way of implementing things, but i think it is not necessarily better.
(In my case I lose due to inline strings, and variable length opcodes which make complications.)