Re: svn: /php/php-src/ branches/PHP_5_3/ext/date/php_date.c trunk/ext/date/php_date.c
| From: | Pierre Joye | Date: | Mon, 24 Jan 2011 12:19:48 +0000 |
| Subject: | Re: svn: /php/php-src/ branches/PHP_5_3/ext/date/php_date.c trunk/ext/date/php_date.c | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51343@lists.php.net to get a copy of this message | ||
On Mon, Jan 24, 2011 at 12:53 PM, Derick Rethans <derick@php.net> wrote:
> On Mon, 24 Jan 2011, Pierre Joye wrote:
>
>> On Mon, Jan 24, 2011 at 11:15 AM, Derick Rethans <derick@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