🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++
Article #115

Re: Destructor called too soon, Destructor not called - G++1.35

#115
From: Piercarlo Grandi
Date: Wed, 06 Sep 1989 11:57
22 lines
1751 bytes
In article <8909040747.AA00164@teacake.sun.com> tiemann@SUN.COM (Michael Tiemann) writes:

   [ ... on passing objects with a destructor to a varargs function ... ]

   Cfront implements the first mechanism, while GNU C++ implements the
   second.  The 2.0 reference manual states that either is an acceptable
   way of doing business.  HOWEVER, if you do it the GNU C++ way, you
   must be honest!  Namely, if you pass an object (not a reference to an
   object) to a function, then such passing must be done type-correctly.
   You can pass it via varargs, but that function must be prepared to
   call a destructor by hand, just as it pulls arguments from the
   argument list by hand.

Actually, in 2.0 you are simply forbidden from passing objects
with a *constructor* (or the assignment operator) to varargs
functions. The problem above cannot arise.  (see section 5.11,
page 229, Lippman's). Obviously the rationale is the same as that
given by Tiemann.
--
Piercarlo "Peter" Grandi           | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth        | UUCP: ...!mcvax!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk
Technical Details
Message-ID: <PCG.89Sep6125705@thor.cs.aber.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!mcsun!ukc!edcastle!dcl-cs!aber-cs!thor!pcg
References: <ANDREWT.89Aug3001106@watsnew.waterloo.edu> <8909040747.AA00164@teacake.sun.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!mcsun!ukc!edcastle!dcl-cs!aber-cs!thor!pcg
From: pcg@thor.cs.aber.ac.uk (Piercarlo Grandi)
Newsgroups: gnu.g++
Subject: Re: Destructor called too soon, Destructor not called - G++1.35
Message-ID: <PCG.89Sep6125705@thor.cs.aber.ac.uk>
Date: 6 Sep 89 11:57:05 GMT
References: <ANDREWT.89Aug3001106@watsnew.waterloo.edu>
 <8909040747.AA00164@teacake.sun.com>
Sender: pcg@aber-cs.UUCP
Distribution: gnu
Organization: Coleg Prifysgol Cymru
Lines: 22
In-reply-to: tiemann@SUN.COM's message of 4 Sep 89 07:47:33 GMT