#include <csetjmp>ide
#include <cstdlib>spa
static jmp_buf g_env;it
void Recursion (int nDepth) {io
if (nDepth >= 3)class
longjmp (g_env, 1);gc
Recursion (nDepth + 1);im
}margin
int main (int argc, char* argv[]) {static
int nRetVal = setjmp (g_env);top
if (nRetVal == 1)
{
return 0;
}
Recursion (0);
return 0;
}
運行流程:
main --> setjmp --(x:跳轉標記)--> if( == 1) --> Recursion() --> longjmp() --> (x:跳轉標記)