excrt_04.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 35 行
C
35 行
// excrt_04 - test copy CTOR throw during construction
#include <stdio.h>
#include <except.h>
struct S
{ S();
S( const S& );
};
S::S()
{
}
S::S( const S& )
{
throw 123L; // throw a long to cause error
}
void fun()
{
S s;
throw s;
}
int main()
{
try {
fun();
} catch( S ) {
printf( "FAILURE -- should have aborted\n" );
fflush( stdout );
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?