Re: Order of operation on multi core hardware
Quote:
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.).
Quote:
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! :rolleyes:
Re: Order of operation on multi core hardware
Quote:
Originally Posted by
laserlight
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.
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 ;)
Re: Order of operation on multi core hardware
Quote:
Originally Posted by
JohnW@Wessex
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.
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.
Re: Order of operation on multi core hardware
Quote:
Originally Posted by
laserlight
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.
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.
But I was agreeing with you. :confused: