From owner-freebsd-hackers Fri Feb 14 20:16:47 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id UAA27437 for hackers-outgoing; Fri, 14 Feb 1997 20:16:47 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id UAA27430 for ; Fri, 14 Feb 1997 20:16:40 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.3/8.6.9) id PAA04061; Sat, 15 Feb 1997 15:15:39 +1100 Date: Sat, 15 Feb 1997 15:15:39 +1100 From: Bruce Evans Message-Id: <199702150415.PAA04061@godzilla.zeta.org.au> To: Arne.Juul@idt.ntnu.no, eivind@dimaga.com Subject: Re: NULL as ((void*)0) (was Re: strlen() question) Cc: hackers@freebsd.org 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 >> ... >This *shouldn't* help. If it does, the code is broken. >All code should do the right thing with varargs; if having NULL be >plain 0 breaks it, so much the better :-) Broken code should be >found and fixed, not nurtured. I like plain 0 as a default because it tends to expose broken code sooner. >Ideally one should define NULL to plain 0 sometimes, to >(void *)0 sometimes, and to (1-1) (or some other bizarre but >legal option) sometimes, just to find bugs in the source tree. I did this for /usr/src/sys. This trick is also useful for types (if you want to see a lifetime's worth of bugs :-(): typedef signed char off_t; ... typedef long double off_t. Bruce