1d5a5390   
   From: daniel.kruegler@googlemail.com   
      
   Am 24.06.2012 14:23, schrieb Rani Sharoni:   
   > On Jun 22, 10:17 pm, Dave Abrahams wrote:   
   >   
   >> The behavior of dtors in the presence of exceptions is   
   >> well-specified, and actually pretty reasonable: when not already   
   >> unwinding, the rest of the current dtor's body is skipped but all of   
   >> the other sub-objects are destroyed as part of unwinding.   
   >   
   > Will the following memory be freed if the dtor of 'A' throws:   
   > delete pA; // pA is of type A for which ~A might throw   
   >   
   > I'm not sure what the standard says about such... (hence how the   
   > implementation of given smart-ptr should 'safely' handle such).   
   > (I know that for 'new A' there is special handling in which memory   
   > gets freed if the ctor throws).   
      
   This was clarified by   
      
   http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#353   
      
   The deallocation function will be called regardless whether the   
   destructor throws.   
      
   I would like to add in regard to this discussion that the behaviour is   
   undefined once a deallocation function terminates via an exception, see   
   [basic.stc.dynamic.deallocation] p3.   
      
   HTH & Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
    [ 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)   
|