Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Apr 2003 01:00:40 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Erik Trulsson <ertr1013@student.uu.se>
Cc:        Jens Schweikhardt <schweikh@freebsd.org>
Subject:   Re: standards/50889: NULL defined as 0 instead of (void *)0
Message-ID:  <20030417005708.D6167@gamplex.bde.org>
In-Reply-To: <20030416125715.GA12300@falcon.midgard.homeip.net>
References:  <200304161249.h3GCntqZ071047@freefall.freebsd.org> <20030416125715.GA12300@falcon.midgard.homeip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 16 Apr 2003, Erik Trulsson wrote:

> On Wed, Apr 16, 2003 at 05:49:55AM -0700, Jens Schweikhardt wrote:
> > I agree, though, that it may be desirable to
> > #define NULL ((void*)0)
>
> Unless you want to use the same definition for both C and C++.
> In C++ the only valid way of defining NULL is
>
> #define NULL 0
>
> because in C++ there is no automatic conversion between "pointer to
> void" and other pointer types as there is in C.

I agree.  It may be, and is, also desireable to define NULL as 0.
A bit more desireable IMO.  Whichever detects the most bugs at compile
time is best.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030417005708.D6167>