delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/02/11/04:48:50

Date: Wed, 11 Feb 1998 11:48:05 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
cc: DJ Delorie <dj AT delorie DOT com>, djgpp-workers AT delorie DOT com
Subject: Re: char != unsigned char... sometimes, sigh (long)
In-Reply-To: <34E00C53.175A@rug.ac.be>
Message-ID: <Pine.SUN.3.91.980211114656.15677A-100000@is>
MIME-Version: 1.0

On Tue, 10 Feb 1998, Vik Heyndrickx wrote:

> - All DOS compilers that I know about (not many), use 'unsigned char' by
> default. SGI uses 'unsigned char' ;)

It would be interesting to know why did GCC choose signed char for
x86.  Does anybody know?  Should we ask the GCC maintainers?  Or maybe 
somebody can tell what are the advantages of signed char?

The reason I think this would be educational is that Vik lists so many
disadvantages of this choice, it almost makes you think GCC is dumb.

> - A char can be used as an array subscript, especially in translation
> tables. Most of the time (99%) the user does not expect that this value
> can be negative.

This unexpected effect is only understandable if a user thinks that
char type is somehow ``magical'' because it represents printable
characters.  But that is not how C defines them: in C they are just
small integers.

Also, ANSI allows an index of -1.

> - If the user want his program to behave in an implementation specific
> way he can always specify "-funsigned-char" or "-fsigned-char" at the
> command line.

Or even edit their lib/specs to make it the default.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019