• 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: Possible C++ optimizer problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible C++ optimizer problem


  • Subject: Re: Possible C++ optimizer problem
  • From: Steve Checkoway <email@hidden>
  • Date: Thu, 20 Jul 2006 14:18:17 -0700


On Jul 20, 2006, at 12:52 PM, Clark Cox wrote:

On 7/19/06, Steve Checkoway <email@hidden> wrote:

subclass of string. (I believe that subclassing the std classes is not allowed. Certainly you cannot add new data members since they might not be destroyed because string doesn't have a virtual dtor.)

Just a minor nit to pick: there is nothing wrong with deriving from a class without a virtual destructor (even adding data members as you go) as long as you don't delete them polymorphically (i.e. you only allocate instances of them as automatic variables, as non-pointer instance variables in other classes, etc.) Or you're sure that the type of the pointer passed to operator delete is pointer to the most-derived type.

You're absolutely correct. As a general (personal) rule, I don't derive from classes without virtual dtors because I've had this bite me before. (Actually, g++ wasn't warning about classes with virtual functions and no virtual dtors which has since been fixed.)


--
Steve Checkoway



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Possible C++ optimizer problem (From: David Dunham <email@hidden>)
 >Re: Possible C++ optimizer problem (From: Steve Checkoway <email@hidden>)
 >Re: Possible C++ optimizer problem (From: David Dunham <email@hidden>)
 >Re: Possible C++ optimizer problem (From: Steve Checkoway <email@hidden>)
 >Re: Re: Possible C++ optimizer problem (From: "Clark Cox" <email@hidden>)

  • Prev by Date: Re: Caching compiled files
  • Next by Date: Re: Building a library using as universal for 10.3.9 ppc from
  • Previous by thread: Re: Re: Possible C++ optimizer problem
  • Next by thread: Converting CW Projects To XCode
  • Index(es):
    • Date
    • Thread