Re: Tiger Build Warnings
Re: Tiger Build Warnings
- Subject: Re: Tiger Build Warnings
- From: Steve Checkoway <email@hidden>
- Date: Thu, 23 Jun 2005 08:18:26 -0700
On Jun 23, 2005, at 7:21 AM, Ben Cox wrote:
In the general case, the potential danger here is that someone will
do this:
AbstractBaseClassWithoutVirtualDestructor *p(something());
p->doStuff();
delete p;
Correct. That's why the warning from gcc is correct.
and the derived class' virtual Release() method will do "delete
this;" if/when the refcount drops to zero. Thus the danger of
"delete p;" on a pointer to the base class is averted by
programming convention/requirements, and the warning is, in this
case, superfluous. (If someone does actually do "delete p;" then
they likely have bigger bugs in their program than this one.)
Actually adding a virtual destructor as Richard suggests would
cause problems with the vtable layout, which would interfere with
COM-like use of the interface class.
How would that cause problems with the vtable layout and how would
that interfere with the COM-like use?
So, I retract my comment last night that AUElementCreator contained
a bug. Sorry.
From the point of view of the c++ standard, it does contain a bug.
I thought there was a G++ attribute you could define (with
__attribute__) on the interface class to suppress the warning, but
I can't find it at the moment.
I can't imagine that you would want to suppress this warning. In
fact, I filed a bug with Apple to get this fixed 6 months or so ago.
It finally was with gcc 4.0.
- Steve
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden