This is the mail archive of the cygwin mailing list for the Cygwin 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: isprint core dump


On 01/23/2012 02:34 PM, Nellis, Kenneth wrote:
> From: Eric Blake
> 
>> No, but it DOES come from POSIX:
>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/isprint.html
>>
>> And cygwin's behavior matches POSIX on this point; the bug is in your
>> program, not cygwin.
> 
> Call me blown away by the level of support this function that
> dumps core is getting, when it could act sanely (IMHO) with a 
> simple "if" statement! So much for defensive programming.

If you want defensive programming, write the defense into your program -
don't call functions with invalid arguments in the first place.  It
costs time to process an if() statement that would be reached by every
single caller, when 99.99% of the callers already comply with the
standards.  Meanwhile, since cygwin inherits its isprint()
implementation from newlib, and newlib caters to embedded systems, you
will be fighting an uphill battle to add anything that adds bloat that
slows down an embedded client.  We already get complaints about cygwin
being too slow, and you are proposing making it slower by doing
safety-net checking for buggy programs.  So we ask instead that you put
the if() in your program, and not in the core isprint() implementation.

-- 
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]