Abandon NULL for (0)

Henry Spencer henry at utzoo.uucp
Sat Oct 7 02:42:38 AEST 1989


In article <15571 at nswitgould.cs.uts.oz> karl_auer_%7801.801 at fidogate.fido.oz (1) writes:
>There is another good reason not to use '(0)' - in some
>implementations of C, pointers can have different sizes, requiring
>that NULL be sometimes defined as (0), sometimes as (0L)...

Such implementations are broken.  In standard C it is *always* legal to
use `0' (the parentheses are unnecessary) anywhere where you could use
NULL.  Of course, it is also necessary to cast those NULLs to the correct
type when passing them as arguments to functions.  (The 0L nonsense is an
attempt, only partially successful, to cater to amateur programmers who
don't bother with this.)
-- 
Nature is blind; Man is merely |     Henry Spencer at U of Toronto Zoology
shortsighted (and improving).  | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list