Subject: Re: Chars
To: None <email@example.com>
From: Charles M. Hannum <firstname.lastname@example.org>
Date: 03/24/1995 16:32:06
Are chars *supposed* to be signed or unsigned by default?
Neither. GCC generally leaves it to whatever the historic practice on
a given CPU is.
ANSI C, section 184.108.40.206, says:
`An object declared as type char is large enough to store any member
of the basic execution character set. If a member of the required
source character set enumerated in $2.2.1 is stored in a char object,
its value is guaranteed to be positive. If other quantities are
stored in a char object, the behavior is implementation-defined: the
values are treated as either signed or nonnegative integers.'
Note that the character set in $2.2.1 is pretty much the basic 7-bit
ASCII character set (minus some of the control characters), though the
encoding is not defined in the C standard.