Path: utzoo!utgpu!water!watmath!clyde!att!mtunx!pacbell!ames!nrl-cmf!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Let's define our own NULL Message-ID: <8138@brl-smoke.ARPA> Date: 23 Jun 88 15:52:02 GMT References: <160@navtech.uucp> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 In article <160@navtech.uucp> mark@navtech.uucp (Mark Stevans) writes: > #ifndef NULL > #define NULL 0 > #endif In fact I do this in a header that I include after all system headers needed for a source module have been included. I use the symbol NULL simply for readability; the macro is never necessary, since 0 is just as good. Of course you still need to cast the null pointer to the appropriate type when using it as a function argument. The only reason for the #ifndef NULL ... #endif is that the implementor of may have chosen ((void *)0) for the definition, which would clash with my redefinition. #undef NULL would serve just as well. Lately I've been starting to think that plain 0 is just as readable..