Skip Navigation

Implementing computed gotos

lexp.lt Implementing computed gotos in C++

A common idiom in virtual machines or state machines is to read data from a list, execute some code depending on the value we read, advance in the list, rinse and repeat. That could be written as: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 std::vector<uint8_t> bytecode = readBytecode(); std::size_...

I just wanted to have a handy description of computed goto that I could refer to, to reuse this concept without having to read thousands of line trying to make sense out of it.

0
0 comments