🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

G++ ignores static destructors under strange conditions

#1491
From: "Douglas C. Schmidt"
Date: Tue, 11 Oct 1988 04:58
35 lines
1139 bytes
Hi,

   Here is a weird program, that prints
   
   hello world
    world

   when compiled and executed with AT&T CC 1.2.1.  G++ 1.27 prints only
   
   hello

   This appears to be an error, but I'm not certain enough of the semantics
of destructors to know for certain.  

   Here's the code:

----------------------------------------      
struct Main {
public:
   Main ( void ) {
      printf ( "hello " );
      exit();
   }   
   ~Main ( void ) {
      printf ( "world\n" );
   }
};

static struct Main Initialization_Code;

main() {
   printf ( "my " );
}
----------------------------------------
Technical Details
Message-ID: <8810102158.aa09824@PARIS.ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!apple!rutgers!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%blanche.ics.uci.edu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!apple!rutgers!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%blanche.ics.uci.edu
From: schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt")
Newsgroups: gnu.g++.bug
Subject: G++ ignores static destructors under strange conditions
Message-ID: <8810102158.aa09824@PARIS.ICS.UCI.EDU>
Date: 11 Oct 88 04:58:31 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 34