CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Why can't member variable be initialized?

    Quote Originally Posted by monarch_dodra View Post
    Last time I investigated was on september 22nd, one day after the release of draft n3126, when this change appeared on wikipedia's C++0x article.
    That change was undone, see http://en.wikipedia.org/w/index.php?...ldid=387105157
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  2. #17
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: Why can't member variable be initialized?

    Quote Originally Posted by laserlight View Post
    That was easy
    Refer to the example in n3126 clause 12.6.2 paragraph 8.
    Yeah, It was right under my nose and I didn't even see it.

    Looking harder, it would appear this is called a "brace-or-equal-initializer". It's not described in a single place, but spread out all over the draft...

    On a related topic, when you write "constructor() : a(), b()", that is called a "mem-initializer". I'm just glad I won't have to say "constructor initializer list" when I know very well an "initializer list" is something else.
    Is your question related to IO?
    Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
    It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured