Abandon NULL for (0)

Norman Diamond diamond at csl.sony.co.jp
Thu Oct 5 14:57:41 AEST 1989


In article <10839 at dasys1.UUCP> jpr at dasys1.UUCP (Jean-Pierre Radley) writes:

>I have found my code to more readable if I use these two defines:
>
>#define	NULLC (char *)0

This one doesn't look so readable to me.  NULLC very clearly means the
character that comes at the end of a string.

Why not try:

  #define  NULLC  '\0'
  #define  NULLS  (char *) 0

(This gives NULLC the exact same definition that NULL should have, but
so what.  The proper use of NULLC helps provide self-documenting code.)

>#define NULLF (FILE *)0

Mixed feelings about this one.  Its name is reminiscent of /dev/null
(and similar pseudo-files on other operating systems).  There is a
difference between a file opened to /dev/null and an unopened file.

-- 
Norman Diamond, Sony Corp. (diamond%ws.sony.junet at uunet.uu.net seems to work)
  The above opinions are inherited by your machine's init process (pid 1),
  after being disowned and orphaned.  However, if you see this at Waterloo or
  Anterior, then their administrators must have approved of these opinions.



More information about the Comp.lang.c mailing list