New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[stmt.expr] p1 There is not only a side effect but also value computation #5183
Comments
Is the difference observable? |
Of course, it is. the provision merely mentions the side-effect. the evaluations of certain expressions only include value computation, this is different. Also, I think using evaluation is better than a sole side effect in any case. |
Obviously, I wasn't asking: will the replacement of «side-effect» with «evaluation» be observable by a reader of the paragraph. The second sentence of [stmt.expr]/1 is an artifact from C++98/03 times, now there is [intro.execution]/9:
and the expression of an expression-statement is a full-expression. I'd say the sentence from [stmt.expr]/1 should be removed. |
@languagelawyer I don't think it can be removed. the next statement is not necessary to be a full-expression, such as the |
Why is this a problem? The condition inside |
The execution of the condition is within the period of the execution of the |
What is the difference between saying that the evaluation completes before the next statement is executed and that it completes before the evaluation of the next full-expression (when the next statement execution starts with the evaluation of this full-expression)? |
@languagelawyer Given an expression-statement A, a statement B that is not a full-expression, a full-expression C whose evaluation is within the execution of B. Here are two utterances:
The first utterance can explicitly specify A -> B -> C. Instead, the second can only specify A-> C, we don't know whether A -> B or not. Symbol -> denotes completed before |
Still don't get why one would need to know about A -> B or not, where symbol -> denotes completed before (whatever this means). |
@languagelawyer I would say I haven't yet figured out a relevant example for this case(i.e. why we want to know A -> B)😅 . Maybe, "coroutine" would involve this domain? Since we have given that a full-expression is sequenced before the next full-expression, why don't we give a similar restriction for the execution relationship between expression-statement and the other statement(in most cases, it does not overlap with the previous provision except the next statement is also a full-expression)? |
I guess that the main problem is that "the execution of a statement" is not clearly specified. But I don't think we need to specify it, as doing so would not make difference. |
[stmt.expr] p1
Consider this example
There is no side effect applying to
a
at#1
. Also, the value computation ofa
(determine the identity of the object) should be completed before the execution of the statement at#2
. We only mention the side effect in [stmt.expr] p1. Maybe, we should say thatThe text was updated successfully, but these errors were encountered: