🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

constructor problem with g++1.34 on sun4-os4

#1815
From: gerry wiener
Date: Thu, 30 Mar 1989 16:44
43 lines
927 bytes
I believe the following program should print

Initialize
Hello, world
Clean up

Instead it prints

Hello, world
Clean up

If the definition of y is placed inside main(), then the program prints

Initialize
Hello, world
Clean up

------------------------------------------------------------------------------
#include <stream.h>

class x
{
public:
  x();
  ~x();
};

x::x()
{
  cout << "Initialize" << "\n";
}

x::~x()
{
  cout << "Clean up" << "\n";
}

x y;

main()
{
  cout << "Hello, world\n";
}
Technical Details
Message-ID: <8903301644.AA01395@toadwar.UCAR.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!TOADWAR.UCAR.EDU!gerry

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!TOADWAR.UCAR.EDU!gerry
From: gerry@TOADWAR.UCAR.EDU (gerry wiener)
Newsgroups: gnu.g++.bug
Subject: constructor problem with g++1.34 on sun4-os4
Message-ID: <8903301644.AA01395@toadwar.UCAR.EDU>
Date: 30 Mar 89 16:44:31 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 43