Is something wrong with the compiler ?
Henry Spencer
henry at zoo.toronto.edu
Thu Sep 27 03:59:48 AEST 1990
In article <884 at gtenmc.UUCP> csp at gtenmc.UUCP (Charudutta S Palkar) writes:
> ... I wrote the following code , and the results I got were absurd.
>
> printf(" Maxint : %d\na = %d\n", ( int )(( unsigned ) ~0 >> 1 ) ,
> a = ( int )(( unsigned ) ( a = ~0 ) >> 1 ));
Sure you know what the results should be? The second expression is
assigning to `a' twice, which has unpredictable effects. However, this
doesn't explain what you're seeing. It does look to me like a compiler
bug.
--
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday| henry at zoo.toronto.edu utzoo!henry
More information about the Comp.lang.c
mailing list