Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Is something wrong with the compiler ? Message-ID: <1990Sep26.175948.8232@zoo.toronto.edu> Organization: U of Toronto Zoology References: <884@gtenmc.UUCP> Date: Wed, 26 Sep 90 17:59:48 GMT In article <884@gtenmc.UUCP> csp@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@zoo.toronto.edu utzoo!henry