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

From: Jim Blandy (jimb at redhat.com)
Date: Mon Oct 3 17:24:04 EDT 2005

Noel Welsh <noelwelsh at yahoo.com> writes:
> 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.

I just happened to have copy of the ISO C standard on-screen!

    Section, paragraph 3:

      An integer constant expression with the value 0, or such an
      expression cast to type void *, is called a null pointer
      constant.55) If a null pointer constant is converted to a pointer
      type, the resulting pointer, called a null pointer, is guaranteed to
      compare unequal to a pointer to any object or function.

Posted on the users mailing list.