This is the mail archive of the cygwin@sourceware.cygnus.com 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]

Re: tolower function


> 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


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