• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Tiger Build Warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Tiger Build Warnings
      • From: Ben Cox <email@hidden>
References: 
 >Tiger Build Warnings (From: "Mark's Studio" <email@hidden>)
 >Re: Tiger Build Warnings (From: Jeff Moore <email@hidden>)
 >Re: Tiger Build Warnings (From: Ben Cox <email@hidden>)
 >Re: Tiger Build Warnings (From: Jeff Moore <email@hidden>)
 >Re: Tiger Build Warnings (From: Richard Dobson <email@hidden>)
 >Re: Tiger Build Warnings (From: Ben Cox <email@hidden>)

  • Prev by Date: Re: Tiger Build Warnings
  • Next by Date: Re: Tiger Build Warnings
  • Previous by thread: Re: Tiger Build Warnings
  • Next by thread: Re: Tiger Build Warnings
  • Index(es):
    • Date
    • Thread