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,542 of 33,346   
   MiB to All   
   Re: Exception in Constructor   
   17 Sep 12 14:24:25   
   
   From: Michael.Boehnisch@googlemail.com   
      
   Am Montag, 17. September 2012 16:20:37 UTC+2 schrieb Stuart:   
   > Huh? What does Garbage Collection have to do with this? The example   
   > you have provided below deals pretty well with dynamically allocated   
   > memory inside an exception-safe constructor.   
      
   In a garbage collected environment you do not need to care at all   
   about the problem in your program code; the memory allocated dynamically   
   in the constructor is free game to the gc next time it runs since there   
   are no more references to it.   
   Please, lets not have a pointless quarrel about whether one memory model   
   is superior to the other by design, I think we can agree that both   
   approaches (deterministic new / delete responsibilities vs.   
   non-deterministic garbage collection) have their advantages and flaws   
   and a flame war on this will provide no progress on the OP's inquiry.   
      
   [..]   
   > The C++ way of doing this would be:   
   > #include    
   [..]   
      
   This was pointed out by Georg Menzl, too, and I agree. However,   
   using "new" was a quick way for the sake of my argument, making an   
   _untracked_ dynamic allocation that would not get cleaned up   
   in case of an exception.   
      
   MiB   
      
      
   --   
         [ 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