[plt-scheme] Testing a pointer for null (FFI)

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Mon Oct 3 05:53:28 EDT 2005

Thanks.  I'll go with the test for zero, which feels a tiny
bit sleazy and I don't recall the C standard specifying
NULL == 0 but works on every implementation I've ever used.


--- Eli Barzilay <eli at barzilay.org> wrote:

> ... it seems that you have a pointer to a pointer, so you
> have to do
> that `ptr-ref'.  You can either do the above, or use
> (ptr-ref the-pointer _pointer) and check if it's #f or
> not.  Both are
> fine since NULL is 0, and using _pointer will cost one
> malloc if the
> pointer is not NULL (but who's counting?)...


Email: noelwelsh <at> yahoo <dot> com   noel <at> untyped <dot> com
AIM: noelhwelsh
Blogs: http://monospaced.blogspot.com/  http://www.untyped.com/untyping/

Yahoo! Mail - PC Magazine Editors' Choice 2005 

Posted on the users mailing list.