From owner-freebsd-hackers Sat Feb 15 01:38:21 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id BAA13357 for hackers-outgoing; Sat, 15 Feb 1997 01:38:21 -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 BAA13344 for ; Sat, 15 Feb 1997 01:38:17 -0800 (PST) Received: (from uucp@localhost) by nic.follonett.no (8.8.5/8.8.3) with UUCP id KAA23518 for hackers@freebsd.org; Sat, 15 Feb 1997 10:36:50 +0100 (MET) Received: from oo7 (oo7.dimaga.com [192.0.0.65]) by dimaga.com (8.7.5/8.7.2) with SMTP id DAA22380 for ; Sat, 15 Feb 1997 03:41:37 +0100 (MET) Message-Id: <3.0.32.19970215034136.00c12990@dimaga.com> X-Sender: eivind@dimaga.com X-Mailer: Windows Eudora Pro Version 3.0 (32) Date: Sat, 15 Feb 1997 03:41:38 +0100 To: hackers@freebsd.org From: Eivind Eklund Subject: Re: NULL as ((void*)0) (was Re: strlen() question) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk At 07:44 PM 2/14/97 -0500, Thomas David Rivers wrote: >[Eivind Eklund] >> 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. [... snipped ...] > > The best definition for NULL is as it is, 0. > > Now, I was wondering just where it would save varargs problems? >Can you elaborate? On most machines, void* has internal structure that is equalient to all other pointers types. This will let an ill-used NULL in a varargs-list quietly 'do the right thing'. It isn't universal, but (assuming that this is a problem that occur a few places), it will save us some woes. We won't _have_ to fix it before things can work, only for code purity and ports to machines with differing internal pointer structure. (Please consider whether followups should go to -chat - this might be getting off-topic.) Eivind Eklund perhaps@yes.no http://maybe.yes.no/perhaps/ eivind@freebsd.org