[cffi-devel] Re: Mutable Pointers

Luís Oliveira luismbo at gmail.com
Fri Jul 14 16:58:51 UTC 2006


Stephen Compall <s11 at member.fsf.org> writes:
> On Fri, 2006-07-14 at 13:30 +0100, Luís Oliveira wrote:
>>    (defmacro incf-pointer (place &optional (offset 1))
>>      `(setf ,place (inc-pointer ,place ,offset)))

> This evaluates the PLACE forms twice.

Doh!

> If I follow correctly, this can be more generally solved with a
> cross-platform setf-expander for POINTER-ADDRESS that requires its PTR
> arg to be a place, whereupon things like (incf (pointer-address
> *ptr*)) and any other place-modifier should work.

Hmm. I find that a bit confusing. (incf (pointer-address foo)) really
makes it look look that foo's address is mutable.

So, I propose incf-pointer again, this time without the double
evaluation bug:

(define-modify-macro incf-pointer (&optional (offset 1)) inc-pointer)

-- 
Luís Oliveira
luismbo (@) gmail (.) com
http://student.dei.uc.pt/~lmoliv/




More information about the cffi-devel mailing list