I have a question regarding valid usage. I know normally longjmp() is valid if setjmp()'s surrounding function hasn't returned yet. But what if the function calling setjmp() was reentered in the same manner causing the stack to setjmp()'s function to be the same as it was before?
For example:
Code: Select all
jmp_buf jmpbuf;
bool jumped = false;
void Opcode()
{
if (jumped) { jumped = false; longjmp(jmbbuf, 1); }
...
if (!setjmp(jmpbuf)) { jumped = true; return; }
...
if (!setjmp(jmpbuf)) { jumped = true; return; }
...
}