[cffi-devel] Inline expansions for pointer operations

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Mon Apr 26 07:11:57 UTC 2010


On Mon, Apr 26, 2010 at 1:11 AM, Luís Oliveira <luismbo at gmail.com> wrote:

> 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?
>

If this is the intended behavior in all platforms then I will have to think
about something else for the inline expansion as well -- is it ok if the
error check is removed for low safety settings?


> +(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?
>

Such a proclamation would not get propagate anywhere -- ECL does not keep
the definion of inline functions

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://tream.dreamhosters.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20100426/059c272e/attachment.html>


More information about the cffi-devel mailing list