Re: Possible C++ optimizer problem
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