Next: , Previous: pointer-address, Up: Pointers


pointer-eq

Syntax

— Function: pointer-eq ptr1 ptr2 => boolean

Arguments and Values

ptr1
ptr2
A foreign pointer.
boolean
T or NIL.

Description

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.

Examples

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

inc-pointer