Re: [PATCH] Use NULL instead of integer 0 in security/selinux/
From: Linus Torvalds
Date: Thu Jul 08 2004 - 00:26:33 EST
On Thu, 8 Jul 2004, Miles Bader wrote:
> "David S. Miller" <davem@xxxxxxxxxx> writes:
> >> What's wrong with using 0 as the NULL pointer? In contexts where
> >> a plain 0 is unsafe, NULL is usually unsafe as well.
> >
> > It's a general sparse cleanup people are doing across the entire tree.
> > It's the "proper" way to do pointer comparisons post-K&R.
>
> But 0 in such a context isn't an integer, it's a pointer...
No it's not.
I'm sorry that you are such a K&R-C bigot that you don't like type
checking. But the kernel DOES like type checking, and the kernel is not
K&R C. The kernel uses strict ANSI, and in fact, is _more_ strict than
ANSI C is in many many ways.
One of the "strict typechecking" rules is that you don't mix integers and
pointers by mistake. The fact that C allows dual usage of the integer "0"
is an anachronism that should have been fixed long ago.
Final word: K&R C without prototypes etc is still "legal C". That doesn't
make it legal kernel code.
Linus
-
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/