Topic: Deallocation function required?


Author: "Wil Evers" <wil@ittpub.nl>
Date: 1997/05/08
Raw View
Hi,

James Kanze <james-albert.kanze@vx.cit.alcatel.fr> wrote in article
<rf5vi4vtt9n.fsf@vx.cit.alcatel.fr>...

> It is not difficult to
> imagine an implementation which puts a pointer to the operator delete in
> the vtbl as well.  The only real difference, of course, is when the
> implementation discovers that it needs the placeholder.  In the case of
> pure virtual functions, it knows it when compiling; in the case of the
> destructor, it cannot know before linking.

Yes, and as you know, in practice, such a difference is significant.
While lots of good things could happen to C++ if implementations were
required to keep extra information around about what's in the different
translation units in a program, I believe it is fair to say that the draft
is careful not to do so.

> My point was that it was not really clear in the draft.  See earlier
> postings in this thread.  The question is: what should be required?

Given a choice, I would rather live with an implementation that tells me to
define an operator delete I know I'm not using, than one invoking undefined
behaviour because I forgot to define an operator delete when I do use it.

I believe that stating in clause 2 of section 3.2 that a non-placement
operator delete for a class is used if that class or one of its base
classes has a virtual destructor would solve the issue.

- Wil
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]