Date: Wed, 11 Feb 1998 11:48:05 +0200 (IST) From: Eli Zaretskii To: Vik Heyndrickx cc: DJ Delorie , djgpp-workers AT delorie DOT com Subject: Re: char != unsigned char... sometimes, sigh (long) In-Reply-To: <34E00C53.175A@rug.ac.be> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.