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 33,032 of 33,346   
   nvangogh to All   
   Why are in class initializers not allowe   
   13 May 13 14:55:01   
   
   From: nvangogh@invalid.net   
      
   In the C++ Standard - before C++11 - any attempt to initialize a   
   variable inside the body of a class would fail at compilation. I am   
   sure that there is / was a very good reason for this, but can't   
   understand why it is so.   
      
   I thought that maybe it was a restriction that was imposed due to some   
   form of resource limitation. I am sure that I am wrong.   
      
   Now C++11 allows in class initializers. This appears to make the class   
   design clearer - or at least much easier to implement for a novice   
   like me as there is no need for a lengthy & possibly erroneous   
   constructor initializer list.   
      
   So out of curiosity - why were (are) in class initializers prohibited   
   in old c++?   
      
      
   --   
         [ 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