且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么时候可以从C ++中的析构函数抛出异常?

更新时间:2022-10-16 12:58:48

只是不要这样做。
如果星星和行星按照您需要的方式对齐...



仍然不要这样做。


I know the rule is to NEVER throw one during a destructor, and I understand why. I would not dare do it. But even the C++ Faq Lite says that this rule is good 99% of the time. What is the other 1% that they fail to delve into?

Link to the C++ Faq Lite bullet point on throwing from ~():

Just don't do it. If the stars and planets align in such a way that you find you need to...

Still don't do it.