[Gc] workaround for C++ exceptions problem

skaller skaller at users.sourceforge.net
Tue Jan 24 19:06:42 PST 2006


On Tue, 2006-01-24 at 14:51 -0800, Boehm, Hans wrote:

> Would it be much of a problem to restrict clients to one in-flight
> exception at a time, per thread?  

What do you mean by 'inflight'?

Any number of exceptions can be 'thrown but not caught' 
at once, provided the scopes of the stack
parts being unwound do not overlap.

In particular, in the process of unwinding the stack,
destructors for objects on the stack are called.
Whilst in the dynamic scope of such a destructor, it is 
quite reasonable to throw an exception which is caught 
inside the destructor dynamic context. 

Observe this will unwind the stack of the destructor,
which calls destructors of locals constructed by
the destructor .. which in turn can do the same
thing.

This, any number of scopes can be in the process
of being unwound at any one time, and any number
of exceptions can be 'in flight' in the sense
they haven't been caught yet.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net



More information about the Gc mailing list