Subject: Re: bin/21645: Localized comments and indent(1)
To: None <netbsd-bugs@netbsd.org>
From: Mishka <mishka@batraq.anything3d.com>
List: netbsd-bugs
Date: 06/18/2003 17:52:52
David Laight <david@l8s.co.uk> wrote:
>
> The (int) cast only gets rid of a warning genberated by some compilers.
>
> The problem is that if 'c' is a signed char, then it is promoted to
> a signed integer using by preserving the sign. This does not DTRT
> for any of the isXXX() functions.
I'll see now. IYSS, how about (int)((unsigned char)c)?
So, the ctype convertion inside isXXXX() functions will looks like:
#define isXXXX(c) ((int)((_ctype_ + 1)[(int)((unsigned char)(c))] & (CTYPE_FLAGS)))
This causes the index [(int)((unsigned char)(c))] will always return
a positive value, even in signed int.
--
BR, Mishka.