c语言的跳转longjmp

#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:跳转标记)

相关文章
相关标签/搜索