| Liste des Groupes | Revenir à cl c |
On Mon, 03 Aug 2026 14:47:21 +0000, Lew Pitcher wrote:
On Sun, 02 Aug 2026 14:17:45 +0000, Kenny McCormack wrote:[snip]
First off, I know the "standards" answer is "Either is correct; you have no
right to complain about anything", but I am not interested in the
"standards" answer. If this is all you can do, then just click Next and go
on.
I'm interested in the "why" of why implementations might prefer one or the
other.
Consider the effects of the integer promotion rules on a system with an 8-bit
execution characterset (CHAR_BIT == 8) that has significant characters in the
0x80 through 0xff range[1], and how it affects the return results of functions
like getchar(), getc(), and fgetc().[1] Not as hypothetical as you might think; Some of the earliest C compilers
(and current compilers as well) targetted the IBM EBCDIC systems, where much
of the basic execution characterset resides between 0x80 and 0xff, with the
numeric characters residing between 0xf0 and 0xf9. A signed <<char>> would
not work here.
For what it's worth, this was also the reason (prior to Unicode) that C
did not specify that alphabetic characters would have a contiguous sequence
in the execution characterset. In EBCDIC, the alphabetics group a-i, j-r, s-z
and A-I, J-R, S-Z, with various other characters (both assigned and unassigned)
between the groupings.
Les messages affichés proviennent d'usenet.