CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Location
    M31
    Posts
    885

    Dumb C++ Question

    Hey, sorry for the silly question, but is:

    int a = 1, b = a;

    defined behavior? that is, if a is initialized properly, b is guaranteed to equal a provided that a is initialized before b, but not as a separate statement delimited by a ';', but delimited by a comma like the example above?

    I just want to make sure that I'm not walking in undefined-behavior territory here...

    Thx.

  2. #2
    Join Date
    Dec 2005
    Location
    Prague, Czech Republic
    Posts
    208

    Re: Dumb C++ Question

    Yes, comma is sequence point just like semicolon, so it's ok.

  3. #3
    Join Date
    Jun 2006
    Location
    M31
    Posts
    885

    Re: Dumb C++ Question

    Thx!

  4. #4
    Join Date
    Aug 2005
    Posts
    478

    Re: Dumb C++ Question


  5. #5
    Join Date
    Jun 2006
    Location
    M31
    Posts
    885

    Re: Dumb C++ Question

    Thx for the reference. I seriously thought that MSDN mainly covered WinAPI stuff, heh, thx again.

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