⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chapter2-31.cpp

📁 C++STL程序员开发指南
💻 CPP
字号:
//文件名:CHAPTER2-31.cpp
#include <setjmp.h>
#include <stdio.h>
jmp_buf j;
void raise_exception(void)
{
	printf("exception raised\n");
	longjmp(j, 1); /* jump to exception handler */
	printf("this line should never appear\n");
} 
int main(void)
{
	if (setjmp(j) == 0){  printf("'setjmp' is initializing 'j'\n");	raise_exception();//Restore context
		printf("this line should never appear\n");	}
	else	{   printf("'setjmp' was just jumped into\n");	/* this code is the exception handler */	}
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -