[plt-scheme] Testing a pointer for null (FFI)
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 6.3.2.3, 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.