This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: tolower function
- To: cygwin@sourceware.cygnus.com
- Subject: Re: tolower function
- From: "J. J. Farrell" <jjf@bcs.org.uk>
- Date: Tue, 8 Jun 1999 18:34:50 -0700 (PDT)
> From: "Peter Kabal" <kabal@ece.mcgill.ca>
>
> In an early version of a function to convert a string to lowercase, I did
> not properly convert the input (signed) characters to unsigned before
> handing them off to the tolower function. I discovered that tolower behaves
> oddly for negative input values. For instance tolower(-32) returns zero,
> while tolower(-31) returns -31.
>
> Perhaps tolower should be fixed to behave "properly" for "improper" inputs.
That's easily done by defining it's current behaviour as
proper, as an extension to C!
The value of the parameter to the ctype functions must be
representable as an unsigned char, or must be EOF. Any other
value results in undefined behavior.
Contributors efforts are probably better spent enhancing the
functionality rather than extending standard interfaces to
make incorrect code behave in some predictable way.
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com