4 ms·
> This is not undefined behavior, it's one of the first things you learn about C after encountering the pre/postfix operators IF you pay attention to the detail
by clarry 13y ago
> This is not undefined behavior, it's one of the first things you learn about C after encountering the pre/postfix operators IF you pay attention to the details, which, with C, you should know to do.
What exactly is not undefined behavior? The post describes a statement where a variable is modified multiple times between sequence points. What does the standard say about this?
N1256, 6.5 says
Between the previous and next sequence point an object
shall have its stored value modified at most once by the
valuation of an expression.
J.2 Undefined behavior
The behavior is undefined in the following circumstances:
[..]
* Between two sequence points, an object is modified more
than once, or is modified and the prior value is read
other than to determine the value to be stored (6.5).
What's with the know-it-all voice?