Pointers-to-members

Christophe de Dinechin ddd at cup.hp.com
Tue Feb 22 23:21:41 UTC 2000


Mark Mitchell wrote:
> 
> >>>>> "Christophe" == Christophe de Dinechin <ddd at cup.hp.com> writes:
> 
>     Christophe> Mark Mitchell wrote:
>     >>  The ABI document says that a NULL pointer-to-member function
>     >> has `ptr == 0'.  It does, not, however say whether or not a
>     >> NULL pointer-to-member function also has `adj == 0'.
>     >>
>     >> I believe that this should be specified as well so that code
>     >> generated to do comparison of pointers to members (of the same
>     >> type) looks like:
>     >>
>     p1-> ptr == p2->ptr && p1->adj == p2->adj
>     >>  and not:
>     >>
>     p1-> ptr == p2->ptr && (!p1->ptr || (p1->adj == p2->adj))
>     >>  So, I would say:
>     >>
>     >> If the pointer-to-member is NULL, both fields are zero.  (Note:
>     >> there are no non-NULL pointers-to-members for which the `ptr'
>     >> field is non-zero.)
> 
>     Christophe>              ^^^^^^^^
> 
>     Christophe> I assume you meant "There are no non-NULL
>     Christophe> pointers-to-members for which the 'ptr' field is
>     Christophe> zero", correct?
> 
> Yes.  I apologize for my own idiocy.
                               ^^^^^^
Another typo, I guess :-)

Ach, but, what is the value for the NULL pointer to data member? I guess -1
would do, unless there are cases I can't think of where the pointer to member
would legitimately have a negative value. Maybe 0x8000000000000000 is better...


Christophe




More information about the cxx-abi-dev mailing list