Victor said:
An example showing where putting postfix ++ in the lower category
would give a different way of parsing than if it's in the higher
category.
int main() {
int a = 42;
++a++; /* shouldn't compile: prefix applied to an r-value */
}
An example that compiles and has defined behaviour.
Or the idiomatic
*ptr++
(first increment, then dereference using the old value).
You're confusing precedence with order of evaluation
(either that or I miss your point). In that example,
postfix ++ could be in the lower category (ie. the same
category as unary *), because that category is
right-associative, so it is *(ptr++) .
In lower category? Meaning what?
In the category of prefix ++, in the table which is the topic
of this thread.
How would you deal with grouping of the
operations? Left-to-right first? Right-to-left first?
Right to left, as stated in that table.
How would you deal with this:
int arr[10] = {1,2,3}, *pa = arr, b = pa++[0];
The only possible ways of parsing that are:
... ((b = pa)++)[0]
and
... b = ((pa++)[0])
and
... (b = (pa++))[0]
and the precedence of ++ is higher than that of
=, so the first is out; and the precedence of [] is higher
than that of =, so the last is out. The relative precedence
of [] and ++ is not involved in this one.
? The higher-precedence indexing applied to the result of the lower-
precedence increment?
The way it is written, there is not a precedence decision involved.