excrt_03.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 29 行

C
29
字号
// excrt_03 - test DTOR during stack unwinding
#include <stdio.h>
#include <except.h>

struct S
{   ~S();
};

S::~S()
{
    throw 123L;     // throw a long
}

void fun()
{
    S s;            // this should be DTOR'ed during unwind
    throw 123;      // throw an int
}

int main()
{
    try {
        fun();
    } catch( int ) {
        printf( "FAILURE -- should have aborted\n" );
    }
    return 0;
}

⌨️ 快捷键说明

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