From owner-freebsd-arch Wed Aug 21 19:58: 5 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DAA6637B401 for ; Wed, 21 Aug 2002 19:58:01 -0700 (PDT) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4B11443E6E for ; Wed, 21 Aug 2002 19:58:01 -0700 (PDT) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id 4B1699E59; Wed, 21 Aug 2002 22:52:25 -0400 (EDT) Date: Wed, 21 Aug 2002 22:52:25 -0400 From: Mike Barcroft To: Garrett Wollman Cc: archie@dellroad.org, arch@FreeBSD.org Subject: Re: NULL Message-ID: <20020821225225.B62302@espresso.q9media.com> References: <20020821.173653.57449387.imp@bsdimp.com> <200208212358.g7LNw8l08243@arch20m.dellroad.org> <200208220245.g7M2jD8A004461@khavrinen.lcs.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200208220245.g7M2jD8A004461@khavrinen.lcs.mit.edu>; from wollman@lcs.mit.edu on Wed, Aug 21, 2002 at 10:45:13PM -0400 Organization: The FreeBSD Project Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Garrett Wollman writes: > In article <200208212358.g7LNw8l08243@arch20m.dellroad.org> you write: > >Seems like the same is true of "0".. e.g., suppose that pointers > >are larger than integers, and you call a variadic function with > >"NULL" as one of the extra parameters: > > > > printf("foo=%p num=%d\n", NULL, 123); > > > >This would get screwed with NULL=0 but work right with NULL=(void *)0. > > That's a feature. (Unfortunately, this feature is not implemented on > ILP32 architectures. Is 0LL allowed as a null pointer constant? That > would break everyone equally in this case.) > > The ultimate answer is that both definitions are useful for finding > (or papering over) different bugs. An application could always cheat and define it's own version of NULL before including any headers. This would mainly be useful for finding bugs, but of course is completely unsupported and probably wouldn't work on other platforms unless they also conditionally define NULL. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message