Subject: Re: `char -> unsigned char'
To: Don Lewis <>
From: Dave Sainty <>
List: current-users
Date: 12/21/1998 00:46:26
Don Lewis writes:

>On Dec 19,  6:02pm, Christos Zoulas wrote:
>> Subject: Re: `char -> unsigned char'
>> On NetBSD, not other systems. I am trying to get the code to be
>> more portable when it is compiled in other OS's. The choice is to
>> either override the native OS's ctype.h and use our own, or
>> cast. Casting is more portable, but more disruptive. If the
>> consensus is that we should not be casting, then I'll back out the
>> changes and fix the header file.
> 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.

The variables in question I doubt have any reason to be unsigned, so
declaring them as "char" seems to be the right thing to do.  It is
just a matter of the interface with the ctype.h functions that a
non-EOF character should be presented as an unsigned 8 bit value.

I think casting is the right thing to do.