Package: cffi

Function pointer-eq

Lambda List

pointer-eq (ptr1 ptr2)


ptr1 -- A foreign pointer.
ptr2 -- A foreign pointer.

Return Value

T or NIL.


The function pointer-eq returns true if ptr1 and ptr2 point to the same memory address and false otherwise.

Implementation-specific Notes

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  

See also