On Fri, 29 Sep 2000, Steve Haslam wrote:
> Actually, gcc seems to be assuming "signed char" on all my platforms
> (Linux/i386,sparc and Solaris 7), unless I specify
> "-funsigned-char". I thought ANSI C said chars were unsigned by
> default? -ansi doesn't change anything... hrm...
From section 5.1.3 of Harbison & Steele, "C: A reference manual", 3rd
edition,
The character type has some special characteristics that set it apart
from the normal singed and unsigned types. For example, the plain char
type may be signed, unsigned, or a mixture of both. For reasons of
efficiency, C complilers are free to treat type char in one of three ways:
(1) Type char may be a signed integral type, equivalent to signed char.
(2) Type char may be an unsigned integral type, equivalent to unsigned
char.
(3) Type char may be a "pseudo-unsigned" integral type; that is, it can
contain only nonnegative values, but it is treated as if it were
a signed type when performing the usual unary conversions.
So gcc can do (2) and acc can do (1) and still be ANSI. Oh, well. See
what happens when a language is defined by a committee.
-j
--
Jeffrey Goldberg
I have recently moved, see
http://www.goldmark.org/jeff/contact.html
Relativism is the triumph of authority over truth, convention over justice