[reSIProcate] 'this' : used in base member initializer list
Cullen Jennings
fluffy at cisco.com
Wed Sep 15 11:05:00 CDT 2004
Perhaps we should add the windows pragma to suppress this warning the one
place it happens since we know it is safe. (or better yet figure a way to
refractor so it does not happen)
On 9/13/04 11:17 AM, "Scott Godin" <slgodin at icescape.com> wrote:
> 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 at xten.com]
> Sent: Monday, September 13, 2004 1:08 PM
> To: 'Alan Hawrylyshen'; 'Scott Godin'
> Cc: resiprocate-devel at list.sipfoundry.org
> 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 at list.sipfoundry.org [mailto:resiprocate-
>> devel-bounces at list.sipfoundry.org] On Behalf Of Alan Hawrylyshen
>> Sent: Monday, September 13, 2004 8:32 AM
>> To: Scott Godin
>> Cc: 'resiprocate-devel at list.sipfoundry.org' 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 at list.sipfoundry.org
>> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel at list.sipfoundry.org
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel
More information about the resiprocate-devel
mailing list