[intro.execution] p8 Sequenced before and the subexpressions thereof
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
Consider this example
int a[2][3] = {{0,1,2},{3,4,5}};
int i = 0;
auto r = a[i++][i++];
[expr.sub] p1 says
The postfix-expression and the initialization of the object parameter of any applicable subscript operator function is sequenced before each expression in the expression-list and also before any default argument.
In this example, a is sequenced before the first i++, and the a[i++] is sequenced before the second i++. [intro.execution] p8 says
An expression X is said to be sequenced before an expression Y if every value computation and every side effect associated with the expression X is sequenced before every value computation and every side effect associated with the expression Y.
Do these two rules guarantee the side effect of the first i++(which is the subexpression of a[i++]) is sequenced before the value computation of the second i++? The meaning of the "associated with" is not clear enough here.
Improvement
An expression X is said to be sequenced before an expression Y if every value computation and every side effect associated with the expression X is sequenced before every value computation and every side effect associated with the expression Y (including these of the subexpressions thereof, if any).
With this improvement, the side effect of the subexpressions is ascribed to the evaluation of the post-expression.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading [intro.execution] p8 and [expr.sub] p1 in the draft, then trace how the wording applies to the nested subscript expressions in the example. Done means resolving the meaning of “associated with” and, if needed, updating the standard wording to make the intended sequencing explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100