wrote:
> On Feb 26, 11:03 am, Leandro Melo <ltcm...@gmail.com> wrote:
>> On 26 fev, 12:47, "AnonMail2...@gmail.com" <AnonMail2...@gmail.com>
>> wrote:
>>> Can someone point me to the specific are of the standard that will
>>> clarify this issue?
>> Well, you should start from a very important C++ guideline which says
>> that destructors should not throw. Never!
>>
>> If you implement a destructor that might throw you'll be unable to
>> rely on others well know C++ idioms. Basically, you won't be able to
>> write exception-safe code and provide any kind of commit-or-rollback
>> guarantee.
>>
>> In addition, you'll also be in trouble when using operators like new[]
>> and delete[].
>>
>> Bottom line: Don't let your destructors throw.
> Never use the word never!
Except about "Exceptions leaving Destructors"
The reasoning I've heard is: When an exception is thrown from any part
of your code, the stack starts to unwind. This includes calling any
appropriate destructors. If a destructor throws an exception, then what
is supposed to happen? Does the new exception take precedence? Does the
old one trump?
The answer is: I don't care, because it is probably not what I want.
Don't let your destructor throw an exception.
Worse case scenario, let the program die immediately.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>