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

From: Miles Bader
Date: Thu Jul 08 2004 - 00:37:53 EST


Linus Torvalds <torvalds@xxxxxxxx> 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 don't have a copy of the standard handy, but google shows this snippet on
the info-minux mailing list:

From ANSI X3.159-1989 3.2.2.3:

An integral constant expression with the value 0, or such an expression
cast to the type void *, is called a null pointer constant. If a null
pointer constant is assigned to or compared for equality to a pointer,
the constant is converted to a pointer of that type.

> Final word: K&R C without prototypes etc is still "legal C". That doesn't
> make it legal kernel code.

Your prerogative.

-Miles
--
"1971 pickup truck; will trade for guns"
-
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/