🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by David Fox Mon, 20 Mar 1989 21:41
static members and gdb-3.1.1
#724
Author: David Fox
Date: Mon, 20 Mar 1989 21:41
31 lines
969 bytes
On the sun-4 I compiled the following program with g++-1.34.1:

	class Box {
	  static int boxId;
	protected:
	  int x;
	  Box() : x(++boxId) {}
	};
	
	main()
	{
	  Box b;
	  int x = 0;
	  x = x + 1;
	}

And when I try to print the value of b I get the following message:

	(gdb) break main
	Breakpoint 1 at 0x2188: file bug.cc, line 11.
	(gdb) run
	Starting program: /u/tom/fox/src/text/bug 

	Bpt 1, main () (bug.cc line 11)
	(gdb) p b
	$1 = {boxId = ptrace: I/O error.
	Cannot read memory: address 0x0 out of bounds.
	(gdb) 

David Fox
fox@cs.columbia.edu
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