avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be added tolibc


From: Russell Shaw
Subject: Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be added tolibc
Date: Mon, 23 Jun 2008 12:47:57 +1000
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

Weddington, Eric wrote:
-----Original Message-----
From: address@hidden [mailto:address@hidden
org] On Behalf Of Joerg Wunsch
Sent: Sunday, June 22, 2008 2:09 PM
To: address@hidden
Subject: Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be added tolibc

As Andy H wrote:

       if (!copy)
               return (copy);
It would be interesting to see whether the more readable version:

        if (copy == NULL)
                return NULL;

generates the same (or less) code.

Good catch. Regardless whether it generates the same code or not, it
should be compared to NULL anyway because one should never rely on NULL
being zero. Since copy is a pointer, it should be compared to NULL, and
not with a logical NOT operator.

http://c-faq.com/null/ptrtest.html

I always use "if(!copy)..."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]