64-bit NULL: a followup
marcel at xcllnt.net
Fri Nov 28 21:56:21 PST 2003
On Sat, Nov 29, 2003 at 04:39:14PM +1100, Bruce Evans wrote:
> > 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
The bogusness doesn't increase if we're looking at widths. It actually
reduces. The FreeBSD runtime is either ILP32 or LP64. Hence, defining
NULL as long is better than defining it as int. For those running
IP32L64, NULL can trivially be redefined as int.
> ((void *)0) is better, but I wouldn't change it, except
> locally to trap errors.
Ok, so what is better (void*)0 or 0L?
Marcel Moolenaar USPA: A-39004 marcel at xcllnt.net
More information about the freebsd-standards