TITLE: Portability and comparing null pointers PROBLEM: ??? ... the constructs if (p) and if (!p) checks for NULL and non-NULL respectively. Is this portable to *all* platforms? RESPONSE: nh@cbnewsg.cb.att.com (nicholas.hounsome) It is NOT portable for C. It is portable for C++ which is the group that you have posted to - did you mean to? RESPONSE: steve@taumet.com (Steve Clamage), 26 Jan 93 Just to reduce confusion, Hounsome's comments are not correct. Tony Hansen posted the best answer to this question. Both C and C++ guarantee that any pointer which compares equal to a null pointer constant is a null pointer, and any null pointer compares equal to a null pointer constant. Finally, any null pointer compares equal to any other null pointer when suitably cast. In C++, a literal zero is most appropriate for use as a null pointer constant. In any event, for both C and C++, use the NULL macro which is supplied in the standard header files in preference to writing your own macro.