Subject: Re: [boost] Question for C++ experts about exception allocation failure
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-05-20 06:50:09
Peter Bindels <dascandy_at_[hidden]> writes:
> 2009/5/18 Anthony Williams <anthony.ajw_at_[hidden]>:
>> I don't think exception objects are allocated on the stack in MSVC, and
>> I don't see how they could be --- if an exception is caught then before
>> the handler is entered the stack needs to be unwound and all the
>> destructors run. Having an exception object lurking halfway down the
>> empty stack space would just confuse things no end.
> I debugged this once to find out what's what exactly and it is halfway
> down the stack. The stack below it is unwound but it is not freed
> until the end of the exception handler. The exception handler executes
> on the stack just above (below) the exception, and the exception is
> destroyed and the stack below it freed when it's done. This all is
> based on empirical measurement.
Wow. I stand corrected.
-- Author of C++ Concurrency in Action | http://www.manning.com/williams just::thread C++0x thread library | http://www.stdthread.co.uk Just Software Solutions Ltd | http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk