Weird result for modulus operation
Robert Dewar
dewar@adacore.com
Wed Apr 30 16:20:00 GMT 2008
Ang Way Chuang wrote:
> Andrew Pinski wrote:
>> On Tue, Apr 29, 2008 at 8:50 PM, Ang Way Chuang <wcang@nav6.org> wrote:
>>
>>> abc.a = abc.a++ % abc.b;
>> You are assigning to abc.a twice without a sequence point inbetween so
>> this code is undefined as the order of evaluation of expressions
>> without a sequence point is unspecified.
> Thanks for the speedy reply. But why this code:
>
> int a = 17, b = 16;
> a = a++ % 16;
>
> results in a = 2 then? I think I need to know what is sequence point.
> I'll google that.
undefined means undefined, you can't expect two
similar undefined constructs to have anaologous
behavior!
>> Thanks,
>> Andrew Pinski
>>
More information about the Gcc
mailing list