From page 123 of the C & K Programming Language :
(p ++) -> x increments p after accessing x. (This last set of parentheses is not needed. Why?)
Why is this not necessary, given that it ->binds stronger than ++?
->
++
EDIT: Contrast this expression with ++p->x, the latter is evaluated as ++(p->x), which will increase x, not p. Therefore, in this case, brackets are necessary and we must write (++p)->xif we want to increase p.
++p->x
++(p->x)
x
p
(++p)->x
, -> , ++. ( , @KerrekSB.)
p x.
, x p, p. -> +.
+
: , ...
, , ++p->x, , ++(p->x), (++p)->x ( , , K & R , , ). , p++->x, (p++)->x. p(++->x), p(++->)x p++(->x) "".
p++->x
(p++)->x
p(++->x)
p(++->)x
p++(->x)
:
. . (p++)->x.
munch , p++->x :
p, ++, ->, x
p++->x : postfix ++ postifx ->. , , . p++->x (p++)->x.
++p->x .
++p->x ++ , ++. C , ++p->x ++(p->x).
EDIT: .
post-increment member access . , , .
postfix-++ (.. p).
→ x , p++. (p++) , .
p++
(p++)
"after" . , p++ p, , , .
Expresion p++leads to a pointer with a value p. The ++part is later executed , but for the purpose of interpreting the expression, it also cannot be there. ->xforces the compiler to add the offset for the member xto the source address in pand access this value.
->x
If you change the instruction to:
p->x; p++;
he will do the same.
The priority order is actually exactly the same as you can see here - but it does not really matter.