本文介绍了抛出的catch(...)抛出的值或引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的老板回答了这个问题非常优雅。
My boss answered this question why ... (three points) in catch block is exist? quite elegantly.
但它使我想到了一些东西(希望弥补我以前的坏问题) ,
But it's made me think of something (and hopefully makes up for my previous bad question), does
catch(...){
throw;
}
通过值重新抛出捕获的异常
rethrow the caught exception by value (i.e. a deep copy is taken), or by reference?
推荐答案
标准说:
- ISO / IEC 14882: 8
换句话说,它只是使用原始异常对象继续异常传播。我想这是类似于你的意思是通过参考。
In other words, it simply continues the exception propagation with the original exception object. I suppose this is analogous to what you mean by "by reference".
这篇关于抛出的catch(...)抛出的值或引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!