www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/06/03:16:40

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Writing to a file from dtor doesn't work!
Date: Tue, 04 Nov 1997 18:22:50 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 34
Message-ID: <345F59EA.3A6081BF@LSTM.Ruhr-UNI-Bochum.De>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 971104132700 DOT 19533H-100000 AT is>
NNTP-Posting-Host: c64.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii wrote:
> 
> On Mon, 3 Nov 1997, Nate Eldredge wrote:
> 
[...]
> > move two lines of code. *Are* files Supposed to work in destructors?
> 
> IMHO, people who use C++ extensively should answer this.  There might
> be conflicts with objects that use I/O streams and are destructed by
> global destructors.  DJ?
> 
> Is it at all safe to assume that file handles beyond the 3 standard
> streams are available in the global destructor?  After all, they *are*
> run after `main' returned, so at least in principle, this is a
> never-never land for the application, no?
Hmm. The destructor is usually called after the scope 
of the variable end. So an object in main is deleted
after main, but _before_ (IMHO) the libc cleanup. 
So I would think this is a bug. 

-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


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