加 抛 不抛 逆 不抛 模块顶 抛 抛 异常 不抛 异常 抛 函数/闭包
来表示
的
.因为
作为默认更好,用在
时,如果有要
的函数,就需要这个
了.因为
成本大,所以默认
才是最经济的,即不需要
的开销.
属性仅对
有用.
void bar() throw;
struct S1 {
nothrow void foo() { bar(); } //错误,不允许抛
}
struct S2 {
void foo() { bar(); } // 可抛
}
void abc() throw throw; // 错误
void bar() throw nothrow; // 错误
nothrow:
foo() throw; // 好
throw:
def() nothrow; // 好