[cpp-threads] RE: Initial comments on your straw man

Nelson, Clark clark.nelson at intel.com
Tue Feb 21 22:05:12 GMT 2006


> > Er, no, sorry.  Sequence points are far more messed up than THAT.
> > Consider f(g(),h()) or g()+h() and ask about the ordering of=20
> > the function executions g() and h().  The consensus is that=20
> > there is a sequence point between them, but there is no=20
> > ordering relation.
> Agreed.  Thanks.  I added a note for now.  Clark Nelson is 
> also working
> on a paper addressing the sequence point issues.  I'd be very happy if
> he got this at least mostly straightened out.

I've put a draft of my paper up at:
http://www.cybcon.com/~cjnelson/n1944.htm. There is just a scant week
before the publication deadline, but comments are welcome.

According to the terms I use in my paper, the executions of g and h are
relatively sequenced -- so they don't interleave and there's no
undefined behavior -- but it is unspecified which is sequenced before
the other. 

> I actually no longer understand what the standard means here. 
>  Assume i
> is a local variable, and f stores through the pointer passed to it.
> 
> Which one of the following is legal?
> 
> (i =3D 13) + (i =3D 14)	-- no
> (i =3D 13) + f(&i)	-- not a clue
> f(&i) + f(&i)	-- yes, otherwise lots of stuff is broken
> 
> Probably the middle one should be undefined, but I have no 
> idea how the
> standard implies that without also outlawing the last one.

My understanding of the intent (which I optimistically call the status
quo) is that the status of the middle example is the same as the last
one. That's supposed to be achieved by requiring that the execution of
the called function doesn't interleave with the execution of the calling
function. I have proposed words intended to make this clear; it's up to
the world at large to tell whether they are clear enough.

Clark



More information about the cpp-threads mailing list