Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Mar 2004 18:11:09 +0100
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= <des@des.no>
Cc:        Mark Murray <mark@grondar.org>
Subject:   Re: NULL vs 0 vs 0L bikeshed time
Message-ID:  <20040301171109.GA61055@falcon.midgard.homeip.net>
In-Reply-To: <xzpoergtt6z.fsf@dwp.des.no>
References:  <200402291546.i1TFkZ0w070591@grimreaper.grondar.org> <xzpoergtt6z.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 01, 2004 at 05:42:28PM +0100, Dag-Erling Sm=F8rgrav wrote:
> Mark Murray <mark@grondar.org> writes:
> > I'd like to commit the following patch. It makes sure that for C
> > and the kernel, NULL is a ((void *)0)
>=20
> This is not correct, because it makes NULL unusable for function
> pointers; you can assign 0 to a function pointer, but not (void *)0.

If it is valid to assign 0 to a function pointer then it is valid to
assign ((void*)0).  They are both null pointer constants
If the compiler does not allow it then it is a compiler bug IMO.

(I am not quite sure if it is actually valid to assign a null pointer
constant to a function pointer, but I think it is, and if it is valid
then any null pointer constant shall work.)


--=20
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se



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