Hi Renato,
> On 25 November 2010 13:31, Duncan Sands<baldrick at free.fr> wrote:
>> In short, all destructors are run, and if any
>> throw
>> exceptions then that fact is noted somewhere (and the exception is not
>> allowed
>> to propagate) and once all destructors have had a chance to run then
one
>> instance of Program_Error is thrown at the point of scope exit.
>
> I see, like keeping the exceptions in a queue as they happen and deal
> with each one in order, until the queue is empty.
not really, there is no queue and no need to keep track of the exceptions
destructors are throwing [*]. The following pseudo-code may explain:
bool saw_exception = false;
for each destructor:
try { run(destructor); }
catch (...) { saw_exception = true; }
if (saw_exception) throw Program_Error;
> It's harder to print stack-traces to the user, but this discussion is
> becoming off-topic. ;)
>
> Anyway, thanks for the explanation!
Yeah, probably highly off-topic (unless someone tries to bake C++ cleanup
behaviour into the new LLVM exception handling model...), so let's stop
here.
Ciao,
Duncan.
[*] In Ada you can't throw general objects so there is no problem finalizing
any exceptions: finalizing an exception never throws an exception.