Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Apr 2003 23:17:28 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Erik Trulsson <ertr1013@student.uu.se>
Cc:        schweikh@freebsd.org
Subject:   Re: standards/50889: NULL defined as 0 instead of (void *)0
Message-ID:  <20030421230733.J11214@gamplex.bde.org>
In-Reply-To: <20030421104840.GA92922@falcon.midgard.homeip.net>
References:  <20030416125715.GA12300@falcon.midgard.homeip.net> <20030416172723.GA13575@falcon.midgard.homeip.net> <20030421104840.GA92922@falcon.midgard.homeip.net>

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

> On Mon, Apr 21, 2003 at 02:01:06AM -0600, M. Warner Losh wrote:
> > I have a #define in my tree that I switch back and forth from time to
> > time:
> >
> > #if defined(_cplusplus) || !defined(_NULL_VOID)
> > #define NULL 0L
>
> Why not just plain 0?
> I think either will work fine so it doesn't matter really matter much
> but I am a bit curious.

Different types of integer for NULL can expose (or hide) bugs like:

		foo(NULL);	/* No prototype in scope. */
	...
	int foo(void *) { ... }

Bruce



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