[cpp-threads] memory model
Peter Dimov
pdimov at mmltd.net
Fri May 6 20:27:49 BST 2005
Boehm, Hans wrote:
> The more I look at this, the less I understand what the actual model
> is here. I expect we need to take this to the core list. My
> fundamental problem is that the standard talks about the placement
> of sequence points in the "execution sequence". But I think
> both of us believe that sequence points are meant to constrain
> the possible execution sequences.
I think that these two mean the same thing. 1.9/3 and 1.9/5 state that there
may exist more than one possible execution sequence. Whether we say that
sequence points constrain the possible execution sequences, or we say that
an execution sequence is valid or invalid depending on whether it obeys the
rules about the sequence points, does not matter.
In other words, if you give me an execution sequence, and I can insert
sequence points in that execution in a manner that satisfies the standard,
then this is a possible execution sequence and a program that produces the
same observable behavior as this execution sequence is conforming.
> An alternate interpretation seems to be that execution sequences are
> otherwise specified, and sequence points constrain the order in
> which "side effects" become visible to the outside world.
"Visible to the outside world" (1.9/6) is weaker than "side effects"
(1.9/7), which include modifying an object.
I don't agree with this interpretation. I think that the intent is for
sequence points to constrain the execution sequences and for observable
behavior to allow further optimizations as per 1.9/5. Besides, as you point
out, the execution sequences are not otherwise specified. :-)
More information about the cpp-threads
mailing list