home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,389 of 33,346   
   Dave Abrahams to All   
   Re: Will we ever be able to throw from a   
   08 Jun 12 12:05:00   
   
   From: dave@boostpro.com   
      
   on Thu Jun 07 2012, Wil Evers  wrote:   
      
   > Dave Abrahams wrote:   
   >   
   >> OK, so, modify D's dtor so that it's noexcept(true) and my point   
   >> still stands.   
   >   
   > Assuming you mean "noexcept(false)": absolutely.   
      
   Duh.  Right.   
      
   > I think everyone agrees that it would be nice if could throw from   
   > destructors   
      
   You can   
      
   > just as we can from anywhere else.   
      
   Aye, there's the rub.  The consequences, as in   
      
      D x,y;   
      
   are a bit more drastic.   
      
   > However, so far, nobody has come up with a convincing idea about what   
   > should happen when that destructor is invoked, either directly or   
   > indirectly, from the stack unwinding machinery.  Which is why I   
   > suspect the problem is more fundamental, and related to the semantics   
   > we associate with destructors.   
      
   Meh.  I think it's pretty obvious that you can continue with the   
   exception that's currently unwinding.  That's the one aborting the   
   current operation.  Trust the programmer: a class that is throwing from   
   its destructor is presumably written to be "properly destroyed"   
   (whatever that means) once the lifetime of the whole object ends, even   
   if the destructor throws.  IMO it would be fine if the second exception   
   had the current semantics for destructors that throw   
   not-during-unwinding, if we discarded that second exception (or chained   
   it, a la std::nested_exception, to the one that's unwinding) once the   
   lifetime of the complete object whose dtor threw had ended.   
      
   --   
   Dave Abrahams   
   BoostPro Computing   
   http://www.boostpro.com   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca