C ++异常规范替换 [英] C++ exception specification replacement
本文介绍了C ++异常规范替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
经过一番阅读,我意识到在C ++中,异常规范被认为是一件坏事:
I have realized, after some reading, that in C++ the exceptions specification is considered a bad thing:
int f() throw(A, B); // bad because a lot of reasons
我不了解的是如何替换它。如何告诉 f()
的呼叫者他必须捕获异常?
What I have not understood is how to replace it. How can I tell to the f()
's caller that he must catch an exception?
推荐答案
怎么样
//throws: A if something is wrong
// B if something else is wrong
int f();
这篇关于C ++异常规范替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文