Re: [PATCH] Use NULL instead of integer 0 in security/selinux/

From: Herbert Xu
Date: Sat Jul 10 2004 - 04:57:47 EST


On Sat, Jul 10, 2004 at 03:39:13AM -0600, Eric W. Biederman wrote:
>
> I would agree that using the constant "0" in a pointer context
> when a more explicit NULL is bad form. But "0" is the one
> legal way in C to write the NULL pointer constant.

One reason I dislike the push to use NULL everywhere is that
new-comers may feel a false sense of security when using NULL.

This will bite in places where an explicit cast is needed to turn
NULL into a null pointer of the correct type, i.e., pointer arguments
to variadic functions.

A neat trick to catch such errors is to define NULL to be 0LL.
This is perfectly legal under ANSI and will generate a different
representation on i386.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/