This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] C++ vs forced unwinding


> >> Hmm... I'm not sure that was a good decision.
> >> Was the ISO C++ committee consulted at all about that?
> >> Is the decision set in stone already?
> >
> > Pretty much.
>
> I disagree.

Fair enough.  But people have already implemented it, at least.

> > Remember that plain longjmp can penetrate throw() if there are no
automatic
> > objects that would be destroyed.
>
> Sure.  longjmp_unwind must reach the setjmp point.  It's not clear that it
> must do this by unwinding.  If unwinding fails, it could fall back on
plain
> longjmp.

Consider:

  struct S { ~S(); };

  void f() throw () { longjmp_unwind (...); }

 void g()  { S s; }

  void h() {
     setjmp (...);
     g();
  }

So, you're saying we would get back to the setjmp point, but not destroy the
local variable s in g?

That would leave the program in an inconsistent state.  I thought the whole
point of longjmp_uwind was to avoid that particular inconsistent state.

-- Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]