rethrow3.c

来自「this is a gcc file, you can download it 」· C语言 代码 · 共 40 行

C
40
字号
#include <stdio.h>#include <stdlib.h>#include <exception>static voideh_terminate (){  printf ("CALLING TERMINATE\n");  exit (1);}voideh_test (int level){  try    {      if (level < 2)	eh_test (level + 1);      else	{	  printf ("%d: Throwing\n", level);	  throw (level);	}    }  catch (int &x)    {      printf ("%d: Got level %d\n",	      level, x);      if (level > 0)	throw;    }}int main (){  std::set_terminate (&eh_terminate);  eh_test (0);}

⌨️ 快捷键说明

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