Subject: Re: Chars
To: None <r.black@ic.ac.uk>
From: Charles M. Hannum <mycroft@ai.mit.edu>
List: current-users
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 3.1.2.5, 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.