Luís Oliveira luismbo@gmail.com writes:
On 2005-dec-18, at 13:25, Surendra Singhi wrote:
Is there any uniform way of passing C null value to functions? Should I pass `0'?
Glad you were able to fix this issue! You should pass (cffi:null- pointer). CLISP does convert NIL to the null pointer which is unfortunate for this reason (Hi Joerg!) :-) And it seems Lispworks does too.
The lack of uniformity is very unfortunate here. This needs to be fixed. We should either a) translate nil->null everywhere, b) don't translate nil->null anywhere or c) offer the two alternatives through two different types.
It will be interesting to know what other lisp implementations like CMUCL, SBCL do? I will vote for clisp's and lispworks approach, it seems least surprising to me.
Another related issue is when a C function returns a null pointer. The behavior in that case should be also uniform.
Thanks.