🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Tue, 11 Oct 1988 04:58
G++ ignores static destructors under strange conditions
#1491
Author: "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 " );
}
----------------------------------------
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