From owner-freebsd-hackers Fri Feb 14 08:54:54 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id IAA15479 for hackers-outgoing; Fri, 14 Feb 1997 08:54:54 -0800 (PST) Received: from nic.follonett.no (nic.follonett.no [194.198.43.10]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id IAA15469 for ; Fri, 14 Feb 1997 08:54:49 -0800 (PST) Received: (from uucp@localhost) by nic.follonett.no (8.8.5/8.8.3) with UUCP id RAA12815; Fri, 14 Feb 1997 17:51:05 +0100 (MET) Received: from oo7 (oo7.dimaga.com [192.0.0.65]) by dimaga.com (8.7.5/8.7.2) with SMTP id RAA15687; Fri, 14 Feb 1997 17:36:53 +0100 (MET) Message-Id: <3.0.32.19970214173652.00c0b290@dimaga.com> X-Sender: eivind@dimaga.com X-Mailer: Windows Eudora Pro Version 3.0 (32) Date: Fri, 14 Feb 1997 17:36:53 +0100 To: Terry Lambert From: Eivind Eklund Subject: NULL as ((void*)0) (was Re: strlen() question) Cc: joerg_wunsch@uriah.heep.sax.de, hackers@FreeBSD.ORG Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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