Is this a bug?
Songtao Chen
songtao@cisco.com
Mon Jan 13 05:17:00 GMT 2003
Hi Zack and Neil,
Thank you very much for the explanation.
Songtao
At 11:09 PM 1/4/2003 -0800, Zack Weinberg wrote:
>Songtao Chen <songtao@cisco.com> writes:
>
> > i = ++i % 2;
> > i = i++ % 2;
>
>Both of these are invalid C - you can't modify i twice in the same
>statement (a slight simplification, which will do).
>
>Write instead
>
> i = (i+1) % 2;
>
>to get the behavior you wanted.
>
>zw
More information about the Gcc-bugs
mailing list