Next: Optimization and Ordering, Previous: Postincrement and Ordering, Up: Order of Execution [Contents][Index]
Operands and arguments can be computed in any order, but there are limits to this intermixing in GNU C:
These rules don’t cover side effects caused by postincrement and postdecrement operators—those can be deferred up to the next sequence point.
If you want to get pedantic, the fact is that GCC can reorder the
computations in many other ways provided that it doesn’t alter the result
of running the program. However, because it doesn’t alter the result
of running the program, it is negligible, unless you are concerned
with the values in certain variables at various times as seen by other
processes. In those cases, you should use volatile
to prevent
optimizations that would make them behave strangely. See volatile
Variables and Fields.