Article View: comp.std.c++
Article #2357Virtual calls on unfinished objects (was: Why allow virtual...)
From: David Vandevoorde
Date: Tue, 31 Oct 1995 02:42
Date: Tue, 31 Oct 1995 02:42
28 lines
1958 bytes
1958 bytes
>>>>> "SC" == Steve Clamage <clamage@Eng.Sun.COM> writes: Thanks for your clarification; I (wrongly) remembered that virtual calls in the constructor used to be prohibited. SC> In article 95Oct29144834@avs.cs.rpi.edu, vandevod@cs.rpi.edu SC> (David Vandevoorde) writes: [...] SC> I think you would have to add this feature, or else disallow SC> virtual calls from constructors and destructors. >> Right now, I think it makes sense disallowing them. SC> The problem is actually a little more subtle. You also have to SC> disallow passing the value of "this" out of a constructor or SC> destructor, or make the results of doing so undefined. A SC> constructor (destructor) for T might call an ordinary global SC> function which takes a pointer to T and calls a virtual function. Or perhaps more generally: virtual calls on incompletely constructed objects are undefined. Hence the this-pointer could be exported by the constructor for storage purposes (and potential call after construction is finished). Would that do? Daveed --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<VANDEVOD.95Oct30130647@avs.cs.rpi.edu>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<VANDEVOD.95Oct29144834@avs.cs.rpi.edu> <472ujv$ns0@engnews1.eng.sun.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 31 Oct 95 02:42:59 GMT Approved: fjh@cs.mu.oz.au From: vandevod@cs.rpi.edu (David Vandevoorde) Newsgroups: comp.std.c++ Subject: Virtual calls on unfinished objects (was: Why allow virtual...) X-Original-Date: 30 Oct 1995 18:06:47 GMT Organization: RPI Computer Science Message-ID: <VANDEVOD.95Oct30130647@avs.cs.rpi.edu> References: <VANDEVOD.95Oct29144834@avs.cs.rpi.edu> <472ujv$ns0@engnews1.eng.sun.com> In-Reply-To: clamage@Eng.Sun.COM's message of 30 Oct 1995 17:53:08 GMT X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMJWNQeEDnX0m9pzZAQF8ZAGAgmH+6XKW74hu7sCwHqkaD9qGJquy+X4A ZlfObYiMuy91XkbQAjrEUI00JayRiEh4 =1iS5