🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #660

negative int bug using g++-.1.36.1 under sun4-os4.0.3

#660
From: gerry wiener
Date: Sat, 02 Dec 1989 00:55
31 lines
1090 bytes
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 <stream.h>

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); */
}
Technical Details
Message-ID: <8912012255.AA01982@toadwar.UCAR.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!TOADWAR.UCAR.EDU!gerry

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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