This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [BUG] wprintf(L"%s", str) expects str to be wide


On 01/11/2013 10:02 AM, Craig Howland wrote:

>      Looks good.  (Good catch on the case 'x', too.)  One very minor
> thing, to be very gung-ho, should you care to bother:
> 
> insize = p ? p - arg : prec;    // works
> 
> insize = (p!=NULL) ? p - arg : prec;    // cleaner

Pointless waste of typing.

> 
> (There's tons of the former, of course, and realistically NULL will
> never be other than 0.)

Even if NULL is not 0 (which the C standard does allow, after all), the
C standard still requires that the conversion of a pointer to boolean
context treats all non-NULL pointers as true, and a null pointer as
false, so you are not buying any robustness by adding an explicit
comparison to NULL.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]