This is not a precedence issue, but an evaluation order issue. It is also not a difference between C and Perl, but a "by design" language specification issue that the evaluation order is not specified by either language. It is the same issue that means that the evaluation order of parameters passed to a sub is not specified.
The language specifications are not specific about the evaluation order in such cases to allow compiler/interpreter writers freedom to evaluate such things in a way that best suits their code generators or optimizers.
It is very likely that different C compilers will generate code that produces different results than you have seen. It is even possible that the same compiler will generate different answers when different compiler options are used.
The bottom line is, don't use expressions or parameter lists where execution results are order dependent such as the examples given, or by calling subs that have side effects.
In reply to Re: Autoincrement operator precedence difference between C and Perl
by GrandFather
in thread Autoincrement operator precedence difference between C and Perl
by Mbk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |