Subtracted from Myers, the fact that two exceptions in the destructor is too much.
What did he mean by that? One exception is not much, but two are many?
It seems to me that already one exception will not allow the application to work normally?

  • Have you tried it yet? - 0xdb

1 answer 1

You misread it :)

There should be no exceptions in the destructor at all . Because imagine - somewhere in the code an exception was generated, the stack convolution went, the removal of objects - i.e. destructor calls. And if at the same time some destructor generates an exception - what will happen? There will be two exceptions, the second being generated during the processing of the first. This is what is meant when two exceptions are said.

On u and then ... what to do next? Which of the exceptions to handle? Continue processing the first, ignoring the second? Ignore the first and process the second?

As a result, the program simply crashes in this situation ...