Path: csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Simple(?) Unicode questions
Date: Mon, 25 Dec 2023 02:03:59 -0800
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <86wmt2tx80.fsf@linuxsc.com>
References:
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="cf83539a01e1a6fb89ca8ebe59d59ac1"; logging-data="3173107"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/EtFxgbkl9sZ9xdhEwnladb+6kd6Al3qU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:sfkiUEanSdr+EcWWNUL0wwzepSs= sha1:KPbnKd/G18LOQUE1nZ59nRe+/M0=
Xref: csiph.com comp.lang.c:379635
Lew Pitcher writes:
> On Wed, 13 Dec 2023 11:05:45 +0800, spender wrote:
>
>> printf("%c",ch), the ch must <0xFF, <255
>
> Not quite.
> 1) ch /must/ represent an integer value.
More specifically, it must have a type that is or promotes
to int, or a type that is or promotes to unsigned int, with
a value that is in the common range of int and unsigned int.
> 2) ch /should/ represent a C char value. Note that a C char /is not/
> defined as an 8-bit unsigned quantity, but as a CHAR_BIT quantity,
> with implementation-defined sign, where CHAR_BIT is /at least/
> 8 bits. [...]
This part isn't exactly right. Any value in the range of char
is okay. However, any value in the range of unsigned char is
also okay. The type 'int' for the argument is meant to include
values returned by, for example, getchar(), and such functions
always return non-negative values (not counting EOF). The rules
for character input/output functions generally convert characters
to unsigned char, and such values are meant to be admissible as
arguments for a %c conversion specifier.