in reply to Re: Re: Auto-increment frenzy
in thread Auto-increment frenzy
Abigail, I think you misspoke. You are indicating that the addition may precede the increments in your second choice.
Indeed. That may happen. Post increment means that the variable will be incremented some time between fetching the old value and the end of the statement. It doesn't say it will be incremented before the evaluation of some other operation in the same statement.
Your earlier statement that behaviour is "undefined" is also incorrect.If my statement is incorrect, it must mean that the behaviour is defined. Please define that behaviour for me, quoting the relevant parts of the documentation.
In my example it doesn't matter, but if both terms use and alter the same variables then there can be side effects between the terms.
Exactly. Hence, undefined behaviour.
Abigail
|
|---|