< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

RE: [reSIProcate] 'this' : used in base member initializer list


I've checked and Derek is right - we are only just storing the 'this'
pointer, which should be safe.  I've added a #pragma that disables the
warning on VS.NET compilers.

Thanks,

Scott

-----Original Message-----
From: Derek MacDonald [mailto:derek@xxxxxxxx] 
Sent: Monday, September 13, 2004 1:08 PM
To: 'Alan Hawrylyshen'; 'Scott Godin'
Cc: resiprocate-devel@xxxxxxxxxxxxxxxxxxx
Subject: RE: [reSIProcate] 'this' : used in base member initializer list

AFAIK, this is a safe use of the this pointer; the value is being stored,
that's it.  I don't think other(smarter) compilers will even complain, but I
haven't checked.

--Derek

> -----Original Message-----
> From: resiprocate-devel-bounces@xxxxxxxxxxxxxxxxxxx [mailto:resiprocate-
> devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Alan Hawrylyshen
> Sent: Monday, September 13, 2004 8:32 AM
> To: Scott Godin
> Cc: 'resiprocate-devel@xxxxxxxxxxxxxxxxxxx' resiprocate-devel
> Subject: Re: [reSIProcate] 'this' : used in base member initializer list
> 
> 
> On Sep 13, 2004, at 11:17, Scott Godin wrote:
> 
> > Derek,
> >
> > [snip]
> >
> > 'this' : used in base member initializer list
> >
> > The this pointer is valid only within nonstatic member functions. It
> > cannot be used in the initializer list for a base class.
> >
> > The base-class constructors and class member constructors are called
> > before this constructor. In effect, you've passed a pointer to an
> > unconstructed object to another constructor. If those other
> > constructors access any members or call member functions on this, the
> > result will be undefined. You should using the this pointer until all
> > construction has completed.
> >
> >
> 
> Scott;
> 
> If we are doing anything other than storing the value of the this
> pointer, then the code as written in non-portable and not language
> compliant -- in other words -- I think it merits looking at what's
> going on and refactoring it.
> 
> Alan
> 
> a l a n a t j a s o m i d o t c o m
> 
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel