> Stevie O <stevie@qrpff.net> said:
> > But x++ is postincrement though. That means the value of 'x' is inserted,
> > and after the expression is evaluated, x is incremented. Right?
>
> Nope. x++ increments x sometime (not defined when) after taking the value.
>
> x = x++ % y
>
> is wrong: There is just one sequence point at the end of the expression,
> and x is modified twice in between (++ and =).
Or look at it that way: both
tmp = x % y; x++; x = tmp;
and
tmp = x % y; x = tmp; x++;
are possible interpretations with different results. And as usual, compiler
is allowed to do literally anything whenever it sees such beast.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/