From -4684410626002628382
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,db4807a3f0a1e742
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-07-26 04:20:07 PST
Path: nntp.gmd.de!Germany.EU.net!EU.net!uunet!news.centerline.com!news!immel
From: immel@chord.centerline.com (Mark Immel)
Newsgroups: comp.std.c++
Subject: Re: Multiple inheritance and delete
Date: 26 Jul 1994 11:19:46 GMT
Organization: CenterLine Software, Inc.
Lines: 42
Message-ID: <IMMEL.94Jul26071948@chord.centerline.com>
References: <IMMEL.94Jul15110950@chord.centerline.com>
	<IMMEL.94Jul18092230@chord.centerline.com>
	<30f0io$cad@f111.iassf.easams.com.au>
	<JASON.94Jul24193114@deneb.cygnus.com>
	<311bhg$t4p@f111.iassf.easams.com.au>
NNTP-Posting-Host: chord.centerline.com
In-reply-to: rjl@f111.iassf.easams.com.au's message of 26 Jul 1994 07:41:04 +1000


>>> Your structs A & B are aggregates and thus do *not* have destructors, however
>>> C is not an aggregate (since it has base classes).  It implicitly has a
>>> destructor, so you code meets the highlighted text.
>>
>>Where is it written that all non-aggregates have destructors?  I don't
>>think that is accurate.
>>

>You could be right here.  According to the ARM 12.4 (pg 277) -
>  "If a base or a member has a destructor and no destructor is declared
>   for its derived class a default destructor is generated"

Notice that this language is quite different from the parallel statement
for constructors (WP 12.1 p. 4):

  "If no constructor has been declared for class X, a default constructor
   is implicitly declared."

The constructor is declared, but :

  "The definition for an implicitly-declared default constructor is generated
   only if the constructor is called."

We could read the statement about destructors, then, to imply that the
destructor is declared and defined if the base classes have destructors, etc..,
or infer that it should have said declared where it said generated, or (and
this is the solution I would favor), parallel the constructor language
exactly:

  "If no destructor has been declared for class X, a default destructor
   is implicitly declared."

Of course, if none of the base classes, member need destructors the compiler
can optimize away any calls (explicit or implicit) to the function.  But,
if I can say ~int, I sure want to be able to say ~X for X any class!

-- Mark Immel
   immel@centerline.com


   


