Subject: Re: `char -> unsigned char'
To: christos@zoulas.com (Christos Zoulas), Don Lewis <Don.Lewis@tsc.tdk.com>
From: Don Lewis <Don.Lewis@tsc.tdk.com>
List: current-users
Date: 12/21/1998 15:00:17
On Dec 20,  8:44am, Christos Zoulas wrote:
} Subject: Re: `char -> unsigned char'

} | Instead of casting, it may be cleaner to declare the relevant variables
} | unsigned.  <stdio.h> also uses unsigned chars.  Alas, <string.h> uses
} | signed chars.  So much for consistency.
} 
} Right, but then the same variables are used for str*() functions as you
} mentioned, so you have to cast there. It's a losing battle.

Yeah, but you can pick the method that requires the fewest casts.  Also,
passing an unsigned char * to the <strings.h> functions on a machine where
char is signed is probably benign, unlike passing a char that happens to
be signed to a <ctype.h> function that doesn't go beyond the ANSI requirements.
You'll probably still get bitten by the second argument to strchr(), etc.