On Fri, 29 Sep 2000, Steve Haslam wrote:
> *blush*
<grin>
> 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...
ANSI C made a pig's ear of this by leaving it as implementation
dependent. Probably because at the time ANSI C was being standardized,
some hardware did one and some did the other (only), and the lobbyists
for each wanted char to be compilable to the native (i.e. fastest)
instructions. It's a fudge that has caught me too often. You develop a
program on one type of hardware, test it and test it, and the minute you
move it to another machine it falls over. That doesn't seem very
"standard" to me...
Personally, I've never understood the need for signed chars anyway.
Whoever thought them up?
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.