longjump執行非局部轉移#include
基本介紹
- 外文名:longjump
- 功 能::執行非局部轉移
- 用 法:void longjump(jmp_buf
- 程式例:#include
函式名: longjump
功 能: 執行非局部轉移
用 法: void longjump(jmp_buf env, int val);
程式例:
#include
#include
#include
void subroutine(jmp_buf);
int main(void)
{
int value;
jmp_buf jumper;
value = setjmp(jumper);
if (value != 0)
{
printf("Longjmp with value %d\n", value);
exit(value);
}
printf("About to call subroutine ... \n");
subroutine(jumper);
return 0;
}
void subroutine(jmp_buf jumper)
{
longjmp(jumper,1);
}