standards/50889: NULL defined as 0 instead of (void *)0

Bruce Evans bde at zeta.org.au
Mon Apr 21 06:17:56 PDT 2003


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


More information about the freebsd-standards mailing list