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,198 of 33,346   
   Miles Bader to Gene Bushuyev   
   Re: Initialization and trivial construct   
   25 Apr 12 21:26:40   
   
   84422238   
   From: miles@gnu.org   
      
   Gene Bushuyev  writes:   
   > But I would also suggest that the constructor might not need to have   
   > the burden of doing those calculations in the first place, it's more   
   > common for a constructor to initialize its members directly from   
   > constructor parameters:   
      
   Certainly it "need not", and indeed it's very common to directly   
   initialize members from the constructor arguments -- but it's most   
   certainly not universal nor always desirable.   
      
   There's nothing wrong [conceptually] with doing non-trivial   
   calculations in the constructor, and often doing so provides the   
   cleanest and most natural interface (the shortcomings of initializers,   
   of course, are an implementation issue).   
      
   -miles   
      
   --   
   Year, n. A period of three hundred and sixty-five disappointments.   
      
      
         [ 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