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 31,645 of 33,346   
   Dave Abrahams to All   
   Re: Looking for an elegant way to conver   
   08 Nov 11 00:10:49   
   
   From: dave@boostpro.com   
      
   on Mon Nov 07 2011, Ulrich Eckhardt  wrote:   
      
   > Am 06.11.2011 09:45, schrieb A. McKenney:   
   >> Francis Glassborow wrote:   
   >   
   >>> ... Yes you can do it all with error codes but I will bet that any   
   >>> programmer who wants to use error codes instead of exceptions will   
   >>> write code that leaks like a sieve (and the leaks will not just be   
   >>> memory but scarce resources as well)   
   >>   
   >> I would argue the opposite.   
   >>   
   >> It is much harder to write code that does _not_ leak resources if   
   >> you have to worry about exceptions.  Nobody had to worry about   
   >> exception safety before exceptions were introduced.   
   >   
   > If you use the spirit behind RAII consequently, you can return from any   
   > line of code just as you can throw from any line of code and no   
   > resources are leaked.   
      
   Almost, but not quite right.  It's important to know that certain   
   operations don't throw, e.g. so you can do error recovery.  You can't   
   just decide to throw from those lines of code.   
      
      
      
   --   
   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