Mail Archives: djgpp/1998/07/26/09:24:27
>Unless I am gravely mistaken, the C standard says that NULL *is* the
>same as 0. Whenever 0 appears in a pointer context, the null pointer is
>used, even if the null pointer on that architecture is not physically
>zero. In fact, NULL is defined as `(void *)0', which simply makes sure
>it is always used as a pointer. `#define NULL 0' is also legal.
>
>Thus, `b == NULL' is equivalent to `!b', which tests to see if `b' is
>nonzero.
>
>This is probably a better topic for comp.lang.c; in fact, read its FAQ.
>It talks about this subject at some length.
You are right. The compiler works out that you're talking about NULL
pointers, so b==NULL can be written as !b.
James Arthur
jaa AT arfa DOT clara DOT net
- Raw text -