www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/04/12:16:43

Sender: crough45 AT amc DOT de
Message-Id: <97Nov4.190937gmt+0100.11651@internet01.amc.de>
Date: Tue, 4 Nov 1997 18:12:35 +0100
From: Chris Croughton <crough45 AT amc DOT de>
Mime-Version: 1.0
To: eyal DOT ben-david AT aks DOT com
Cc: eliz AT is DOT elta DOT co DOT il, djgpp AT delorie DOT com
Subject: Re: Writing to a file from dtor doesn't work!

eyal DOT ben-david AT aks DOT com wrote:

> I think that this sample should be checked with g++ on 
> unix, to see if it is DJGPP specific problem.

I just tested it with that exact program using GCC 2.7.2.2
on DEC Alpha (OSF/1), and it works:

$ cat > 1.cc
#include <stdio.h>
class A 
{
private:
        FILE *fl;
public:
        A(void)
        {
                fl = fopen("test.log", "wt");
                fprintf(fl, "In A constructor\n");
        }

        ~A(void)
        {
                fprintf(fl, "In A destructor\n");
                fclose(fl);
        }
};

A a;

int main(void)
{
        return 0;
}
$ gcc 1.cc
$ ./a.out 
$ cat test.log
In A constructor
In A destructor
$ gcc --version
2.7.2.2

It seems to be therefore a DJGPP bug (in the library?  I'm
not sure which bit of it the startup/exit code is in).

Chris C

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019