From owner-freebsd-standards@FreeBSD.ORG Fri Nov 28 21:39:23 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B98A916A4CE for ; Fri, 28 Nov 2003 21:39:23 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 149C743FEA for ; Fri, 28 Nov 2003 21:39:22 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id QAA19270; Sat, 29 Nov 2003 16:39:14 +1100 Date: Sat, 29 Nov 2003 16:39:14 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Marcel Moolenaar In-Reply-To: <20031129005823.GA20090@dhcp01.pn.xcllnt.net> Message-ID: <20031129161509.J4841@gamplex.bde.org> References: <20031129005823.GA20090@dhcp01.pn.xcllnt.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: standards@freebsd.org Subject: Re: 64-bit NULL: a followup X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2003 05:39:23 -0000 On Fri, 28 Nov 2003, Marcel Moolenaar wrote: > Notice the "st8". Since NULL is a pointer constant, programmers do > (implicitly) expect it to have the same width as a pointer type and > thus do not cast it to a pointer type or an integer type that has a > width larger or equal to a pointer type. FreeBSD programmers would never do that ;-), since style(9) requires casting of NULL in function args and mentions this point. (This part of style(9) was written before everything in FreeBSD was prototyped, so the cast was required even for non-variadic functions.) > So, the bottomline is that we currently do have third-party code that > fails to run on ia64 (and possibly other 64-bit platforms) due to the > fact that NULL is defined as 0. > > Since Erik thinks 0 and 0L are both perfectly good definitions for > NULL and Tony emphasizes that NULL is an integer expression, I think ^^ may be > we should change the definition of NULL to 0L to improve portability > to FreeBSD/LP64. It will definitely fix known breakages on ia64. This would be bogus. Long doesn't have the same width as `void *' on all machines. ((void *)0) is better, but I wouldn't change it, except locally to trap errors. __builtin_null would be better for trapping errors. Bruce