Path: utzoo!attcan!uunet!pilchuck!dataio!gtenmc!csp From: csp@gtenmc.UUCP (csp) Newsgroups: comp.lang.c Subject: Is something wrong with the compiler ? Message-ID: <884@gtenmc.UUCP> Date: 25 Sep 90 17:01:15 GMT Reply-To: csp@gtenmc.UUCP (Charudutta S Palkar) Organization: GTE Telecom, Inc. Bothell, WA Lines: 23 Assuming that the 2's complement system is used to represent the negative integers. I wrote the following code , and the results I got were absurd. C code : main() { int a; printf(" Maxint : %d\na = %d\n", ( int )(( unsigned ) ~0 >> 1 ) , a = ( int )(( unsigned ) ( a = ~0 ) >> 1 )); } Output : Maxint : -1 a = 2147483647 Can some complier writer tell me why this is happening ? csp - csp@gtenmc.UUCP K&R C > ANSI C