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,037 of 33,346    |
|    Wil Evers to nvangogh    |
|    Re: Why are in class initializers not al    |
|    14 May 13 10:33:11    |
      From: bouncer@dev.null              nvangogh wrote:              > 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++?              You may be reading too much into this; I don't think there's any       fundamental reason why in-class initializers were disallowed in       C++98/03, although there are some weird corner cases. For an in-depth       discussion, see              http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2628.html              Regards,              - Wil                     --        [ 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