Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!TOADWAR.UCAR.EDU!gerry From: gerry@TOADWAR.UCAR.EDU (gerry wiener) Newsgroups: gnu.g++.bug Subject: negative int bug using g++-.1.36.1 under sun4-os4.0.3 Message-ID: <8912012255.AA01982@toadwar.UCAR.EDU> Date: 2 Dec 89 00:55:08 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 31 When the program below is compiled and executed, it produces the following output: min value is -./,),(-*,( max value is 2147483647 When the two lines containing cout are commented out and the printf line is uncommented, the following output is produced: e is -2147483648, f is 2147483647 ------------------------------------------------------------------------ #include main() { int e; int f; e = 1; /* make larger */ while (e > 0) { e <<= 1; f = e - 1; } cout << "min value is " << (int)e << '\n'; cout << "max value is " << (int)f << '\n'; /* printf("e is %d, f is %d\n", e, f); */ }