<<< Date Index >>>     <<< Thread Index >>>

Re: Little code cleanup



On Sat, Mar 08, 2008 at 02:53:51AM +0100, Vincent Lefevre wrote:

> where X is an array. Moreover, gcc gives a warning for
>   if (X == 0)
> but not for
>   if (X == (void *) 0)
> This is completely unintuitive!

Why is this unintuitive?

X is a pointer.
0 is *not* a pointer. It's an integer.
(void *)0 is a pointer.

So, yes, I would expect a warning when you compare a pointer to an integer.
Why wouldn't you?

-- 
Paul