[omniORB] non-virtual destructors

Diego Roig diego.roig@grupoclave.com
Thu, 16 Mar 2000 11:49:35 -0300


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BF8F56.DA56F4D0
Content-Type: text/plain;
	charset="windows-1252"
Content-Transfer-Encoding: quoted-printable

If the class already has virtual functions, the pointer is already =
there.
Adding one more virtual function should not have space overhead, just =
time
overhead when it=B4s called.

-----Mensaje original-----
De: Stefan Seefeld [mailto:seefelds@MAGELLAN.UMontreal.CA]
Enviado el: Jueves 16 de Marzo de 2000 11:43
CC: omniorb-list@uk.research.att.com
Asunto: Re: [omniORB] non-virtual destructors


David Riddoch wrote:

> No.  This is perfectly legal c++ code, and in my opinion the compiler
> should not issue a warning.  These objects are only ever 'delete'd =
through
> a pointer to the most derived type -- so we are sure to call the =
correct
> destructor.  The behaviour with virtual destructors is identical, but =
has
> a space and time cost.

did you measure this ? The space 'overhead' should be one pointer per
vtbl, i.e. per class. This isn't worth mentioning, is it ? Time =
overhead
depends largely how frequent these objects are destructed.

Stefan
_______________________________________________________             =20
             =20
Stefan Seefeld
Departement de Physique
Universite de Montreal
email: seefelds@magellan.umontreal.ca

_______________________________________________________

      ...ich hab' noch einen Koffer in Berlin...


------_=_NextPart_001_01BF8F56.DA56F4D0
Content-Type: text/html;
	charset="windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dwindows-1252">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2448.0">
<TITLE>RE: [omniORB] non-virtual destructors</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>If the class already has virtual functions, the =
pointer is already there. Adding one more virtual function should not =
have space overhead, just time overhead when it=B4s called.</FONT></P>

<P><FONT SIZE=3D2>-----Mensaje original-----</FONT>
<BR><FONT SIZE=3D2>De: Stefan Seefeld [<A =
HREF=3D"mailto:seefelds@MAGELLAN.UMontreal.CA">mailto:seefelds@MAGELLAN.=
UMontreal.CA</A>]</FONT>
<BR><FONT SIZE=3D2>Enviado el: Jueves 16 de Marzo de 2000 11:43</FONT>
<BR><FONT SIZE=3D2>CC: omniorb-list@uk.research.att.com</FONT>
<BR><FONT SIZE=3D2>Asunto: Re: [omniORB] non-virtual destructors</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>David Riddoch wrote:</FONT>
</P>

<P><FONT SIZE=3D2>&gt; No.&nbsp; This is perfectly legal c++ code, and =
in my opinion the compiler</FONT>
<BR><FONT SIZE=3D2>&gt; should not issue a warning.&nbsp; These objects =
are only ever 'delete'd through</FONT>
<BR><FONT SIZE=3D2>&gt; a pointer to the most derived type -- so we are =
sure to call the correct</FONT>
<BR><FONT SIZE=3D2>&gt; destructor.&nbsp; The behaviour with virtual =
destructors is identical, but has</FONT>
<BR><FONT SIZE=3D2>&gt; a space and time cost.</FONT>
</P>

<P><FONT SIZE=3D2>did you measure this ? The space 'overhead' should be =
one pointer per</FONT>
<BR><FONT SIZE=3D2>vtbl, i.e. per class. This isn't worth mentioning, =
is it ? Time overhead</FONT>
<BR><FONT SIZE=3D2>depends largely how frequent these objects are =
destructed.</FONT>
</P>

<P><FONT SIZE=3D2>Stefan</FONT>
<BR><FONT =
SIZE=3D2>_______________________________________________________&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>Stefan Seefeld</FONT>
<BR><FONT SIZE=3D2>Departement de Physique</FONT>
<BR><FONT SIZE=3D2>Universite de Montreal</FONT>
<BR><FONT SIZE=3D2>email: seefelds@magellan.umontreal.ca</FONT>
</P>

<P><FONT =
SIZE=3D2>_______________________________________________________</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...ich hab' noch einen =
Koffer in Berlin...</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01BF8F56.DA56F4D0--