Article View: comp.std.c++
Article #1506Re: Public comment on the CD
From: Ulf Schuenemann
Date: Mon, 31 Jul 1995 10:52
Date: Mon, 31 Jul 1995 10:52
47 lines
2479 bytes
2479 bytes
I've posted Ajay Kamdar's proposal to the german DIN-group (most of them
from Siemens Nixdorf Informationssysteme AG) at ISO.
Manfred Lichtmannegger made a good point (new surprises) in his answer:
To make destructors of a polymorphic class virtual is a cheap strategy
as a vtbl-pointer already exists.
But a virtual destructor is only necessary if a non trivial destructor (*)
in some derived class exists (**). This is totally independent whether the
class is polymorphic or not (ignoring the virtual destructor itself :-).
The main problem with the proposal is that if you remove the last virtual method,
the destructor will loose its implicit virtual, independently whether the virtual
was semantically necessary or not.
I think this side effect would really surprise programmers. Therefore the
proposal would reduce the frequency of a common programming error by
introducing a new subtlety. You reintroducing a new area for this common
programming error, as it is hard ito trace whether the destructor has lost
its virtuality by changes in direct or indirect base classes.
(*) for instance deleting some pointer members
(**) this condition is not locally deceidable. Therefore the best would be
to define every destructor virtual, but in some cases the vtbl-ptr would
be to expensive.
MfG Manfred Lichtmannegger
--
"Autobahnen sind elementar auch in der Oberhoheit der Laender"
Bundeskanzler Kohl zur Zukunft der Datenautobahnen
email: Manfred.Lichtmannegger@mch.sni.de
[ address and telephone eleded ]
Ulf Schuenemann
--------------------------------------------------------------------
Ulf Schünemann
Fakultät für Informatik, Technische Universität München, Germany.
email: schuenem@informatik.tu-muenchen.de
WWW: http://www.informatik.tu-muenchen.de/cgi-bin/nph-gateway/hphalle2/~schuenem/index.html
...there is only one way to "skin a C+@"...:) -- Jim Fleming
Technical Details
Message-ID:
<3viclo$8cf@sunsystem5.informatik.tu-muenchen.de>Path:
arc1-ca.pugleaf.net!informatik.tu-muenchen.de!schuenemReferences:
<3v0pam$1lv@jabba.lehman.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!informatik.tu-muenchen.de!schuenem From: schuenem@informatik.tu-muenchen.de (Ulf Schuenemann) Newsgroups: comp.std.c++ Subject: Re: Public comment on the CD Date: 31 Jul 1995 10:52:40 GMT Organization: Technische Universitaet Muenchen, Germany Distribution: world Message-ID: <3viclo$8cf@sunsystem5.informatik.tu-muenchen.de> References: <3v0pam$1lv@jabba.lehman.com> NNTP-Posting-Host: hpbroy11.informatik.tu-muenchen.de Originator: schuenem@hpbroy11.informatik.tu-muenchen.de