[plt-scheme] c-lambda NULL -> #f
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))
with
(format "(~a ? scheme_make_cptr(~~a, ~s) : scheme_false)"
c-var
(cadr type))
Was anyone relying on the implemented behavior, as opposed to the
documented behavior?
Matthew