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,360 of 33,346   
   Francis Glassborow to DeMarcus   
   Re: Will we ever be able to throw from a   
   04 Jun 12 18:48:40   
   
   From: francis.glassborow@btinternet.com   
      
   On 04/06/2012 13:46, DeMarcus wrote:   
   > Hi,   
   >   
   > There is always a big discussion about exceptions and when and where   
   > they can be thrown.   
   >   
   > In Exceptional C++ by Herb Sutter, p.55, he states why throwing from   
   > destructors is a bad thing. Apparently for a lot of people in the   
   > community (including myself) it has been difficult to be convinced that   
   > the bad thing with throwing from a destructor is more than just an   
   > unsolved technical detail.   
   >   
      
   >From my perspective it is more than that. Once the body of a dtor has   
   been entered the object's lifetime has ended. Now what happens when you   
   throw from a dtor? The object is dead but has not been properly buried.   
   How is the clean up supposed to happen?   
      
   I once thought throwing from a dtor was fine but as I came to think   
   about it I came to realise that if something happens within a dtor that   
   means that it is not possible to complete the clean-up then the process   
   needs something much more drastic than throwing an exception. Exceptions   
   are designed to pass problems from the place where they can be detected   
   to the place where they can be dealt with, but how can that apply to a   
   dtor, either you can handle the problem locally or the problem cannot be   
   handled but can only be ignored.   
      
   Francis   
      
      
   --   
         [ 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