From: Jason Shirk (jasonsh_at_[hidden])
Date: 2001-08-22 01:23:34
The following only applies to the MS implementation of EH, I'm not
familiar with enough with any other implementation to comment.
When you throw an exception, the exception object is allocated on the
stack (please don't ask why, I can only guess.) The stack cannot be
physically unwound before entering a catch because the thrown object
might be rethrown from a catch. The stack pointer is restored after the
catch exits normally.
This means that _alloca can be called from within the catch, but the
result cannot be used outside the catch.
There is one other constraint that is really a bug. With VC6, you can't
call _alloca from within a try block. The stack pointer is not restored
correctly after taking an exception. This has been fixed in VC7.
VC++ Compiler Team
From: John Max Skaller [mailto:skaller_at_[hidden]]
Sent: Tuesday, August 21, 2001 10:30 PM
Subject: Re: [boost] Re: Technical session at the October C++ meeting?
Greg Colvin wrote:
> It turns out that Windows does support alloca, that it
> does allocate from the stack, and that it is safe to
> use in C++ so long as you don't call it in a catch
> clause expression.
Thanks: that's an interesting constraint!
(The EH relies on the frame pointer BP, not the
stack pointer SP .. so what's special about catches?)
-- John (Max) Skaller, mailto:skaller_at_[hidden] 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 New generation programming language Felix http://felix.sourceforge.net Literate Programming tool Interscript http://Interscript.sourceforge.net Info: http://www.boost.org Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk