Date: Sat, 15 Feb 1997 03:41:38 +0100 From: Eivind Eklund <eivind@dimaga.com> To: hackers@freebsd.org Subject: Re: NULL as ((void*)0) (was Re: strlen() question) Message-ID: <3.0.32.19970215034136.00c12990@dimaga.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.32.19970215034136.00c12990>