[RFC] C++ vs forced unwinding

Theodore Papadopoulo Theodore.Papadopoulo@sophia.inria.fr
Mon Apr 7 16:33:00 GMT 2003

mharrold@cas.org said:
> From a programmer point of view, I'd like to see functions defined as
> throw() do one thing and one thing only when an exception is thrown,
> and that is call unexpected(). Anything else is code bloat. Exceptions
> might be a simple method for providing thread cancellation for the
> compile writers, but it changes the expected behaviour and size of my
> program. 

OK, I know this is yet another extension (YAE), but anyway...

Why not simply create an exception type _NonCatchableException (or 
_Cleanup or _AutomaticallyRethrownException or whatever you find more
suitable) that the compiler recognize and handles specifically.

That would, at least, let the user specify things explicitely, which 
is IMHO much better than any "hidden" behavior.
If a function declared as throw() gets a _NonCatchableException, then 
we are allowed to call  unexpected()...

If the YAE stuff is the only drawback, the feature could very well be 
marked as experimental, so that users can be warned not to rely on it 
yet, until approved in some standard, ABI or whatever.

Then, I cannot evaluate the cost of implementing and maintaining 
such a thing, and that is of course of some importance. Still, gcc is 
one of the best (if not the best) framework to evaluate experimental 
features and it would be bad not to


Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01

More information about the Gcc-patches mailing list