In C++ is there any portable way of jumping to a computed offset?
<p>I'm looking for a portable way of jumping to a computed offset in C++.</p>

<p>I know that GCC has a mechanism for doing this using goto as discussed here:</p>

<p><a href="http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/ec7e52b5-0978-4123-9d29-9dc7d807c6b4" rel="nofollow">http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/ec7e52b5-0978-4123-9d29-9dc7d807c6b4</a></p>

<p>Sadly I don't think other compilers implement this.</p>

<p>Normally I wouldn't have reason to use goto in C++ but I found that it could be useful for optimizing an interpreted language (search for 'threaded interpreter' if you are interested in this).</p>

<p>I know that I can implement this using inline assembly language, but the problem then is I have to implement this for every platform the interpreter runs on.</p>

<p>So does anyone know if there is a portable way of doing this?  </p>

<p>The solution might involve goto but I'm open to any other sort of hackery that you can think of ;)</p>

<p>UPDATE: Currently the interpreter uses a switch statement.  I'm looking for techniques that improve on this and make the interpreter run faster.  Specifically I'm trying to figure out a portable way of saying 'goto &lt;next-byte-code-instruction&gt;' where &lt;next-byte-code-instruction&gt; is a computed offset that can be stored in the byte code itself.</p>

<p>UPDATE: I found a related question here. 
<a href="http://stackoverflow.com/questions/511566/what-opcode-dispatch-strategies-are-used-in-efficient-interpreters">What opcode dispatch strategies are used in efficient interpreters?</a></p>
