DragonFly commits List (threaded) for 2005-04
Re: cvs commit: src/lib/libc/string strcasecmp.c
-On [20050428 21:32], Matthew Dillon (dillon@xxxxxxxxxxxxxxxxxxxx) wrote:
> Joerg, char's are NOT unsigned.
>main(int ac, char **av)
> char x = -1;
> printf("%d\n", x);
> See? NOT unsigned. And we aren't going to make them unsigned, either.
ANSI C99, section 6.5.2:
15 The three types char, signed char, and unsigned char are collectively
called the character types. The implementation shall define char to have the
same range, representation, and behavior as either signed char or unsigned
35) CHAR_MIN, defined in <limits.h>, will have one of the values 0 or
SCHAR_MIN, and this can be used to distinguish the two options. Irrespective
of the choice made, char is a separate type from the other two and is not
compatible with either.
#define CHAR_MAX UCHAR_MAX /* max value for a char */
#define CHAR_MIN 0 /* min value for a char */
#define CHAR_MAX SCHAR_MAX /* max value for a char */
#define CHAR_MIN SCHAR_MIN /* min value for a char */
So in the default case, Matt is right. But it is a choice we as an
implementation can make ourselves.
Jeroen Ruigrok van der Werven <asmodai(at)wxs.nl> / asmodai / kita no mono
Free Tibet! http://www.savetibet.org/ | http://ashemedai.deviantart.com/
http://www.tendra.org/ | http://www.in-nomine.org/
You are more than you think, less than you could be...