[cffi-devel] Inline expansions for pointer operations

Luís Oliveira luismbo at gmail.com
Sun Apr 25 23:11:52 UTC 2010


On Sun, Apr 25, 2010 at 6:43 PM, Juan Jose Garcia-Ripoll
<juanjose.garciaripoll at googlemail.com> wrote:
> ... provided in this patch.

I have a few questions about this patch.

 (defun pointer-eq (ptr1 ptr2)
   "Return true if PTR1 and PTR2 point to the same address."
-  (= (ffi:pointer-address ptr1) (ffi:pointer-address ptr2)))
+  ;; In ECL two pointers are EQUAL if they point to the same address.
+  (equal ptr1 ptr2))

One advantage of the previous definition is that passing non-pointers
to POINTER-EQ would (I assume) signal an error. What do you think?


+(define-compiler-macro null-pointer ()
+  '(si::allocate-foreign-data :void 0))

Any reason why a simpler (declaim (inline null-pointer)) wouldn't work
just as well?

-- 
Luís Oliveira
http://r42.eu/~luis/




More information about the cffi-devel mailing list