🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by gerry wiener Sat, 02 Dec 1989 00:55
negative int bug using g++-.1.36.1 under sun4-os4.0.3
#660
Author: 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); */
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads