Hi,
I am puzzled as to why all operators are listed in the precedence hierachy.
For example it makes perfect sense to have a hierachy for Addition/Multiplication operators so that you can make sense of:
int i = 4 * 9 + 3;
However, why state that the postfix increment operator is of greater precedence that the prefix increment operator? Surely, under any conditions that I can think of they would be goeverned by the associativity rule.
For example :
int i = 1;
int j = i++ + ++i;
The precednce of postfix/prefix are irrelanvent as the operands of the addition operator are evaluated left to right.
There must be a reason, so if any of you good folks could provide me with an example of why precedence rules exist for all operators I would be very grateful.
Thanks in advance,
Simon
I am puzzled as to why all operators are listed in the precedence hierachy.
For example it makes perfect sense to have a hierachy for Addition/Multiplication operators so that you can make sense of:
int i = 4 * 9 + 3;
However, why state that the postfix increment operator is of greater precedence that the prefix increment operator? Surely, under any conditions that I can think of they would be goeverned by the associativity rule.
For example :
int i = 1;
int j = i++ + ++i;
The precednce of postfix/prefix are irrelanvent as the operands of the addition operator are evaluated left to right.
There must be a reason, so if any of you good folks could provide me with an example of why precedence rules exist for all operators I would be very grateful.
Thanks in advance,
Simon