>>8-10it's funny because while switch can be very easily implemented O(1) or very close to it (ex O(log n)) MS Visual C++
tm Enterprise edition uses O(n)
>>1How would one go about making a virtual machine without using a huge and clumsy switch( opcode ) statement?
you can use a array with function pointers but I remember some other ways too
another way is to have a huge and clumsy switch but let the preprocessor handle it (just like I did)
I had made a script in bash and with the help of the preprocessor I had made it so it will map every opcode in a switch statement to a function or some lines of code while I do not give it a list of the functions (the were in another file and the list was generated by the script in the stile X(functionName, something, somethingElse) and was used by many parts of my program
sorry if I am not understandable, I am sleepy