On Wed, Oct 13, 2004 at 02:28:54PM +0200, Andrea Campi wrote: > We have two calls to tolower(); the first doesn't cast the result > at all, the second one casts it to char. Shouldn't the first one be > changed also? man tolower (Solaris - but if FreeBSD differs, someone has a problem): NAME tolower - transliterate upper-case characters to lower-case SYNOPSIS #include <ctype.h> int tolower(int c); > Actually, my first feeling was to change both to unsigned char, but > I'm sure somebody could go to great lenghts to explain to me how the > code as it stands is carefully crafted to work whether chars are signed > or unsigned.... Noting that tolower() returns an int, and char's sign is unspecified, either changing the type for c (to int) or adding a cast is a good idea. Adding casts is generally a bad idea. -- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:17 UTC