Closed hying-caritas closed 10 years ago
Are you sure? I mean: why NIL is better than CFFI:NULL-POINTER ?
IMHO, NIL is the lisp translation of CFFI:NULL-POINTER, so that the user can be more lispy. Just like in foreign-string-to-lisp, if input parameter is CFFI:NULL-POINTER, the return value will be NIL.
foreign-string-to-lisp has signature (cffi:pointer -> (or string null)). It returns NIL for null pointer, because empty string and null string differs.
giarg->pointer has signature (giarg struct -> cffi:pointer). I don't see, why one should make it (giarg struct -> (or cffi:pointer null)).
OK. I see. For giarg->pointer and pointer->giarg, it seems not good to replace CFFI:NULL-POINTER with NIL.
But for string and struct/object, I still think it is reasonable to use nil. That is, if we translate the value between pointer and lisp, we will always use lisp value: string/struct/object/nil; if we don't translate, we always use raw pointer, including null-pointer. Do you agree?
Yes, agree. Please make new pull request
Null pointer processing and argv utility functions.