Date: Fri, 14 Feb 1997 17:36:53 +0100 From: Eivind Eklund <eivind@dimaga.com> To: Terry Lambert <terry@lambert.org> Cc: joerg_wunsch@uriah.heep.sax.de, hackers@FreeBSD.ORG Subject: NULL as ((void*)0) (was Re: strlen() question) Message-ID: <3.0.32.19970214173652.00c0b290@dimaga.com>
next in thread | raw e-mail | index | archive | help
I hereby propose changing the default declaration of NULL under FreeBSD from #define NULL 0 to #define NULL ((void*)0) for better type-safety and ease of transition to other architechtures (e.g. Alpha). This will probably save us from a quite a few varargs-voes, as well as generally making sure the code-base is using NULL correctly, which is important for those reading source-code. At 03:52 PM 2/13/97 -0700, Terry Lambert wrote: >> > > | style(9) - Kernel source file style guide >> > >> > See, there's the problem: libc is a user space library, not >> > a kernel source file. >> >> But that wasn't what you claimed being your original problem, right? >> I wonder when you ever admit being wrong for the first time... > >I said that strlen() took a NULL terminated string. I corrected >it to 0 terminated string to make the nit-pickers happy. "NUL" >with one "L" is the invention of a Pascal programmer with nothing >better to do than to make noises about sign-extension on non-two's >complement hardware for type demotion of 0 to character. NULL is not equvalient to null or 0 or NUL. What you're talking about is best called a null-terminated string, as this is what it is. If you have a Pasacal or Lisp reference handy, you can look up nil - nil in Pascal/Lisp is the same as all uppercase NULL in C. (I'm not doing this _only_ to pick a nit - I'm doing it because it is somewhat that is important both for semantic understanding and for portability.) Eivind Eklund perhaps@yes.no http://maybe.yes.no/perhaps/ eivind@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.32.19970214173652.00c0b290>