www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/18/06:31:44

From: sparhawk AT eunet DOT at (Gerhard Gruber)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Deconstructors
Date: Sat, 18 Jul 1998 10:16:08 GMT
Organization: Customer of EUnet Austria
Lines: 48
Message-ID: <35b0757c.6543544@news.Austria.EU.net>
References: <35AFE02F DOT 3C4857ED AT logic-gate DOT com> <35AFEF99 DOT 29955266 AT alcyone DOT com> <35b6691c DOT 3375145 AT news DOT Austria DOT EU DOT net> <35B06FF0 DOT E4E83F1 AT alcyone DOT com>
NNTP-Posting-Host: e093.dynamic.vienna.at.eu.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Destination: Erik Max Francis <max AT alcyone DOT com>
From: Gruber Gerhard
Group: comp.os.msdos.djgpp
Date: Sat, 18 Jul 1998 02:50:40 -0700:

>Even if that's true, it doesn't have any bearing on whether the C++
>class objects are actually _constructed_ or not.  On Linux, gcc 2.7.2.2
>destructs automatic objects immediately after block exit, regardless of
>whether or not it's the main function block.

I just used main. You can use any other function as main is not really special
as a function.

>> Your above statement
>> would mean
>> that c1 is constructed at the entry of main (that's true) and
>> deconstructed at
>> the exit of main (also true). But c2 would be constructed afer
>> entering the
>> condition and deconstructed when leaving that condition. I'm nbot sure
>> if this
>> is true.
>
>It is with gcc, and thus almost certainly with DJGPP.  Give it a try.

I will. But I really wonder about this, because this would mean that gcc
treats classes totally different from other variables.

>
>> That's why I usually write a function that resets the object and call
>> this
>> function when I need it and also from the destructor.
>
>You are talking about something which is not the same thing as "calling
>the destructor."

Yes. I know. This was only a suggestion if somebody needs to call the
destructor functionality.

--
Bye,
   Gerhard

email: sparhawk AT eunet DOT at
       g DOT gruber AT sis DOT co DOT at

Spelling corrections are appreciated.

- Raw text -


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