DragonFly BSD
DragonFly commits List (threaded) for 2005-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/lib/libc/string strcasecmp.c


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Apr 2005 09:35:28 -0700 (PDT)

:...
:compatible with either.
:
:machine/limits.h:
:
:#ifdef __CHAR_UNSIGNED__
:#define CHAR_MAX        UCHAR_MAX       /* max value for a char */
:#define CHAR_MIN        0               /* min value for a char */
:#else
:#define CHAR_MAX        SCHAR_MAX       /* max value for a char */
:#define CHAR_MIN        SCHAR_MIN       /* min value for a char */
:#endif
:
: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

    Yes and no.  In theory you can make char's unsigned, and in fact
    they are on some machines (like SGI's, I believe).   But the
    standard is a throwback for old architectures that can't handle 
    signed chars, and actually making a char unsigned by default on
    a modern machine just creates massive confusion.  (keep in mind
    that even the venerable 6502 and 8085 had no problem with 
    'signed' chars).

    It's so confusing that even systems with unsigned char defaults
    have compiler options to make them signed by default... which
    makes things even MORE confusing.  But you see, they didn't 
    have a choice.  People were screaming about their systems being
    incompatible because chars were unsigned when everyone else's
    chars were signed.

    So ... for all intents and purposes, we can assume that char's
    are signed, because there is no way they will be anything else
    on any architecture we ever port to.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]