On Thu, 2012-04-19 at 14:37 +0100, Luís Oliveira wrote:
> On Thu, Apr 19, 2012 at 11:34 AM, Stelian Ionescu <sione...@cddr.org> wrote:
> > IMO the change to mem-aref is bad and will break a lot of code. Until
> > now the contract of mem-aref was that it received a pointer to an array
> > of the referenced type and returned a pointer offset into the array.
> > The fact that it now returns a list is a gratuitous change, with no
> > utility. If we actually want these semantics(not sure about it), it
> > should be mem-aptr to implement them
> 
> If it's not too difficult, can you extract a self-contained test case
> that has been broken?

(defcstruct timespec (sec :int64) (usec :int64))

(with-foreign-object (p '(:struct timespec) 2)
  (mem-aref p '(:struct timespec) 1))

In order not to break existing code, I think that mem-aref should
continue to return a pointer in this case instead of a plist. That would
allow cffi-using code to work as it is and not have to be rewritten(an
example that was brought to my attention is
https://gitorious.org/commonqt/commonqt/blobs/master/info.lisp#line312).

Since both functionalities will continue to be present in CFFI, it's
better not to force users to review their code to decide, for each use
of mem-aref, whether it needs to be converted to mem-aptr or not.

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
http://common-lisp.net/project/iolib

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to