Next: with-foreign-object, Previous: pointer-address, Up: Pointers
T
or NIL
.
The function pointer-eq
returns true if ptr1 and
ptr2 point to the same memory address and false otherwise.
The representation of foreign pointers varies across the various Lisp
implementations as does the behaviour of the built-in Common Lisp
equality predicates. Comparing two pointers that point to the same
address with EQ
Lisps will return true on some Lisps, others require
more general predicates like EQL
or EQUALP
and finally
some will return false using any of these predicates. Therefore, for
portability, you should use POINTER-EQ
.
This is an example using SBCL, see the implementation-specific notes above.
CFFI> (eql (null-pointer) (null-pointer)) => NIL CFFI> (pointer-eq (null-pointer) (null-pointer)) => T