[plt-scheme] c-lambda NULL -> #f

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Oct 30 21:35:31 EST 2002

At Wed, 30 Oct 2002 18:05:14 -0500 (EST), dvanhorn at emba.uvm.edu wrote:
> The compiler manual states the C to Scheme conversion is NULL -> #f, but...
> (define f
>   (c-lambda () (pointer "char") "___result = NULL;"))
> (f) -> #<c-pointer:char> and not #f as I had expected.
> Am I doing something wrong here?

No. The implemenation of `c-lambda' was wrong. 

I've exp-tagged a fix in the CVS repository. To repair a non-CVS
installation, replace line 164 in plt/collects/compiler/cffi.ss:

 (format "scheme_make_cptr(~~a, ~s)" (cadr type))


 (format "(~a ? scheme_make_cptr(~~a, ~s) : scheme_false)" 
         (cadr type))

Was anyone relying on the implemented behavior, as opposed to the
documented behavior?


Posted on the users mailing list.