cleanup1.c

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

C
35
字号
// Bug: obj gets destroyed twice because the fixups for the return are// inside its cleanup region.extern "C" int printf (const char *, ...);int d;struct myExc { };struct myExcRaiser {  ~myExcRaiser() { throw myExc(); }};struct stackObj {  ~stackObj() { ++d; printf ("stackObj::~stackObj()\n"); };};int test(){  myExcRaiser rais;  stackObj obj;  return 0;}int main(){  try {    test();  }  catch (myExc &) {    return d != 1;  }  return 1;}

⌨️ 快捷键说明

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