[RFC] C++ vs forced unwinding

Michael Matz matz@suse.de
Wed Apr 2 11:12:00 GMT 2003


Hi,

On Tue, 1 Apr 2003, Richard Henderson wrote:

> On Tue, Apr 01, 2003 at 06:43:13PM -0500, Jason Merrill wrote:
> > Hmm.  It might be reasonable to make the same judgement about a throw(int)
> > function, but I'm inclined to keep throw() as a special case.
>
> Anyone else have an opinion here?

/me not being a C++ expert, but here is mine anyway: ;)

throw() states that a function doesn't throw an exception.  And it should
only say that.  I can't find a reason why it also should say, that such a
function can't call cancellation points, especially because it's a rather
difficult to get right requirement.  The reason is, that such cancellation
points are not part of C++, which means, that it suddenly is impossible to
write standard conforming programs, like:

int f() throw()
{
  try { g(); } catch (...) {}
}

If g() calls cancellation points this perfectly fine program suddenly
doesn't work per your definition of throw().


Ciao,
Michael.



More information about the Gcc-patches mailing list