This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is this a bug?


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






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]