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)   
|