[reSIProcate] Another question on KeepAlive
John Draper
lists at webcrunchers.com
Wed May 3 16:43:05 CDT 2006
Alan Hawrylyshen wrote:
>
> On May 3, 2006, at 02.18, John Draper wrote:
>
>>
>> I stopped at the "if keepAlive" - then checked the following variables
>>
>> message is 0x887ae00
>> keepAlive = 0x0
>>
>> Shouldn't the keepAlive be the same pointer as "message", only it's
>> just dynamic casted?
>>
>> Is there something I overlooked? Could the compiler be messed up?
>
>
> Interfaces are sometimes constrained to a set of object that are more
> general than required.
> This is a C++ understanding issue, not a resiprocate issue.
>
>
>
> From:
> "The C++ Programming Language" - Bjarne Stroustrup [you already have
> this book, I'm sure]
>
> Section 15.4 Run-Time Type Information
>
> [...]
> Recovering the "lost" type information [from the general base-class
> interface] of an object requires us to somehow ask the object to
> reveal its type. Any operation on an object requires us to have a
> pointer or reference of a suitable type for the object. Consequently,
> the most obvious and useful operation for inspecting the type of of
> an object at run time is a type conversion operation that returns a
> valid pointer if the object is of the expected type and a null
> pointer if it isn't. The dynamic_cast operator does exactly that. [...]
>
> 15.4.1 dynamic_cast
> [...]
> Consider the following:
> dynamic_cast<T*>(p)
>
> If 'p' is of type T*, or an accessible base class of T, the result is
> exactly as if we had simply assigned p to a T*. [..]
>
> The purpose of dynamic_cast is to deal with the case in which the
> correctness of the conversion cannot be determined by the compiler.
> Im that case,
>
> dynamic_cast<T*>(p)
>
> looks at the obbject pointed to by p (if any). If that object is of
> class T or has a unique base class of type T, then dynamic_cast
> returns a pointer of type T* to that object; otherwise 0 is returned.
> If the value of p is 0, dynamic_cast<T*>(p) returns 0.
>
> A
>
Thanx for the C++ tip... I miss my C++ reference book. I'm not at
home, due to health issues and
my need for access to more powerful Mac computers. And yes - I have
that book... just not here...
John
More information about the resiprocate-devel
mailing list