[cpp-threads] Static member functions, member access syntax and sequenced-before
Peter Dimov
pdimov at mmltd.net
Wed Nov 23 23:34:12 GMT 2011
N.M. Maclaren wrote:
> The point is that, if you write down a syntactic dependency tree based on
> the specification in the standard (i.e. excluding any details of what the
> actual values are), you get to the situation that the evaluation of the
> expression requests[0].Waitall is not dependent on the evaluation of the
> expression requests[0].
The standard (N3290) says, in 5.2.5 [expr.ref] p1, that
"The postfix expression before the dot or arrow is evaluated;[64] the result
of that evaluation, together with the id-expression, determines the result
of the entire postfix expression."
and footnote 64 specifically explains that
"If the class member access expression is evaluated, the subexpression
evaluation happens even if the result is unnecessary to determine the value
of the entire postfix expression, for example if the id-expression denotes a
static member."
It doesn't matter that you can statically determine that the value of
requests[0].Waitall is Request::Waitall. The function call is sequenced
after requests[0], its evaluation being a part of the evaluation of
requests[0].Waitall, and that's that.
More information about the cpp-threads
mailing list