其他分享
首页 > 其他分享> > c – `void func()throw(type)`有什么意义?

c – `void func()throw(type)`有什么意义?

作者:互联网

我知道这是一个有效的c程序.
函数声明中抛出的重点是什么? AFAIK它什么都不做,不用于任何东西.

#include <exception>
void func() throw(std::exception) { }
int main() { return 0; }

解决方法:

这是一个例外规范,几乎肯定是bad idea.

它声明func可能会抛出一个std :: exception,而func发出的任何其他异常都会导致调用unexpected().

标签:c,standards,throw
来源: https://codeday.me/bug/20191001/1839289.html