The posts What can I use instead of the arrow operator, `->`?
and Arrow operator (->) usage in C
state
The following two expressions are equivalent:
x->y (*x).y
But this does not appear to always be true when taken as a mathematical equivalence.
Why does g++ throw an error when replacing
a->b->c
with
a->(*b).c
?
It seems the above equivalence is not always replaceable. Therefore, I think the term “equivalent” is a bit misleading.
Also, I am not referring to any sort of overloading in this question.
You’ve got the associativity rules wrong.
a->b->cis(a->b)->c, nota->(b->c), so it becomes(*(a->b)).c(and then(*((*a).b)).c).