🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by gregg hanna Tue, 11 Aug 1992 07:03
g++ and groff's c++test.c
#920
Author: gregg hanna
Date: Tue, 11 Aug 1992 07:03
48 lines
1354 bytes
Hi,

  I was trying to build groff but it didn't pass the c++
compiler test in c++test.c, which is:

#include <stdio.h>

struct A {
  A() { fputs("A\n", stdout); }
  ~A() { fputs("~A\n", stdout); }
};

A a;

main()
{
  return 0;
}


I thought maybe the optimizer trashed it, but I tried it
several different ways.  It appears that g++ does not call
the creator for statically declared variables.  Is this
correct behavior?  The following, however, works fine:

#include <stdio.h>

struct A {
  A() { fputs("A\n", stdout); }
  ~A() { fputs("~A\n", stdout); }
};

main()
{
  A a;
  return 0;
}


If this is not a bug, perhaps the groff people should
be notified, since groff-1.05 currently will not compile
if it fails the c++test.  By the way, the groff people
expect the output of the program to be:
A
~A

                                            gregg hanna
                                            gregor@kafka.saic.com
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