🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Laurenz Wiskott Fri, 09 Oct 1992 16:38
gcc-2.2.2 libg++-2.2 a bug ?
#1179
Author: Laurenz Wiskott
Date: Fri, 09 Oct 1992 16:38
55 lines
1683 bytes
	Dear 'GNU',

We are just changing from the AT&T C++ compiler to your gcc-2.2.2 with
the libg++-2.2. And the bugs changes also. I think I've found a bug
concerning pointer assignment to a pointer of a pointer inside a
global declared class. Here follows a simple example:

----------------------------------------------------------------------

#include <stream.h>

class TestClass
{
 public:

  char *string;
  char **stringPtr;

  TestClass() {
    stringPtr = &string; 
  };

  void testNewDelete(char flag) {
    char *localString;
    cerr << flag <<endl; (*stringPtr) = localString;
    cerr << flag <<endl;
  };
};

char *string;
char **stringPtr;

TestClass outerTestClass;

main()
{
  stringPtr = &string; 

  char *localString;
  cerr << "A" <<endl; (*stringPtr) = localString;

  TestClass innerTestClass;
  cerr << "B" <<endl; innerTestClass.testNewDelete('b');

  cerr << "C" <<endl; outerTestClass.testNewDelete('c');

  cerr << "D" <<endl;
};


-----------------------------------------------------------------

I got always a Segmentation fault for line 'C' and can't see why.

	Kind regards, Laurenz Wiskott.
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