CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 37 of 37
  1. #31
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: Order of operation on multi core hardware

    You claim that the execution order of a C++ program is not defined.
    Yes, when writing multi-threaded/multi-core applications I claim (with third party citations) that the observed behaviour of one thread from the point of view of another is not defined. The compiler and CPU can rearrange the order of execution (allowed by the C++ standard). The observed order of execution within the thread is defined (by the C++ standard); not so from the point of view of a second thread (not defined by the C++ standard that most people still use.).

    The old C++ standard didn't cover concurrent usage....
    Never make concurrent accesses to shared memory and if you do be damned sure you know what you're doing because you're in uncharted territory not covered by the standard
    Exactly the point I've been trying to make all along!
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  2. #32
    Join Date
    May 2009
    Posts
    2,413

    Re: Order of operation on multi core hardware

    Quote Originally Posted by laserlight View Post
    Actually, if a C++ program contains an expression for which the order of evaluation is unspecified by the standard, then the order of evaluation is implementation defined. In this sense, implementations of the C++ standard do define the execution order of certain C++ programs. Of course, "implementation defined" means that the behaviour is within the parameters set out by the standard, but it is still implementation defined as to what the order of evaluation ultimately is, so any argument that "it's the C++ standard alone that defines the execution order of a C++ program" is purely academic.
    I don't consider the C++ standard "purely academic".

    The C++ standard defines a nondeterministic (as opposed to a deterministic) abstract machine and the reason is the fact you keep coming back to namely that some orders are unspecified and left to the implementations.
    Last edited by nuzzle; December 19th, 2011 at 11:21 AM.

  3. #33
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Order of operation on multi core hardware

    Quote Originally Posted by nuzzle
    I don't consider the C++ standard "purely academic".
    Neither do I
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  4. #34
    Join Date
    May 2009
    Posts
    2,413

    Re: Order of operation on multi core hardware

    Quote Originally Posted by JohnW@Wessex View Post
    Exactly the point I've been trying to make all along!
    It doesn't matter how many time you make this point, it's still wrong as I explained in #29.

  5. #35
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Order of operation on multi core hardware

    Quote Originally Posted by nuzzle
    It doesn't matter how many time you make this point, it's still wrong as I explained in #29.
    Err... so you are saying that your statement below is wrong?
    Quote Originally Posted by nuzzle
    The old C++ standard didn't cover concurrent usage....
    Never make concurrent accesses to shared memory and if you do be damned sure you know what you're doing because you're in uncharted territory not covered by the standard
    It sounds reasonable to me.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  6. #36
    Join Date
    May 2009
    Posts
    2,413

    Re: Order of operation on multi core hardware

    Quote Originally Posted by laserlight View Post
    Err... so you are saying that your statement below is wrong?

    It sounds reasonable to me.
    Sure it's reasonable because I wrote it.

    And not only reasonable, it's a fact I think everyone can agree on. The old C++ standard didn't cover concurrent usage very well if at all. But this doesn't give people carte blance to claim that execution order is not defined by the C++ standard (see my post#29). The standard rules and the implementations comply is an important principle especially for newbies and the OP to understand (see my post #23).

    That's it for me unless someone has something new to add. Thank you for this discussion.
    Last edited by nuzzle; December 19th, 2011 at 11:25 AM.

  7. #37
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: Order of operation on multi core hardware

    Quote Originally Posted by nuzzle View Post
    It doesn't matter how many time you make this point, it's still wrong as I explained in #29.
    But I was agreeing with you.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

Page 3 of 3 FirstFirst 123

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