On Mon, Jan 24, 2011 at 12:53 PM, Derick Rethans <der...@php.net> wrote:
> On Mon, 24 Jan 2011, Pierre Joye wrote:
>
>> On Mon, Jan 24, 2011 at 11:15 AM, Derick Rethans <der...@php.net> wrote:
>>
>> > Why did you change this? It does exactly the same.
>>
>> No it does not. This test is now correct given its initial goal.
>
> Uh? Since when is:
>        if (!foo)
> not the same as:
>        if (foo == NULL)
>
> Both test whether foo is NULL.
>
> Please provide an explanation why you think this is not providing the
> same results.

NULL is for pointers where 0 is for integer-like.

Testing if a ptr is NULL should be done by testing for NULL or not NULL.

While compilers tolerate *ptr = 0 by casting 0 to NULL, any other
runtime check must use NULL. That's K&R 101.

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to