Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: unsigned int Date: Wed, 03 Aug 2016 08:58:43 -0700 Organization: None to speak of Lines: 41 Message-ID: References: <87h9b4uy39.fsf@bsb.me.uk> <0584a001-91b8-48d9-80de-3c7db52f5aaa@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="28576"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kRSDWZrz6/+FOoKse+pFi" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:s3EY0UiOxdPYOXb7ckBibfy0M+8= sha1:XghL86DJcGTw9E9JFpA86PzlJ10= Xref: csiph.com comp.lang.c:91609 David Brown writes: > On 02/08/16 19:16, supercat@casperkitty.com wrote: >> On Tuesday, August 2, 2016 at 11:50:36 AM UTC-5, Les Cargill wrote: >>> I simply have to disagree. The default 'C' int declaration is >>> signed unless it's explicitly made unsigned. >> >> All ASCII characters are in the range 0..127, so all members of the C >> Character Set are guaranteed have character codes in the range >> 0..SCHAR_MAX regardless of CHAR_BITS. > it's not clear what you mean by "the C Character Set". N1570 5.2.1 describes 4 different character sets: the (source and execution) (basic and extended) character sets, all of which may differ. > require ASCII, and C can be implemented with many different character > sets as long as they cover the standard 26 letter Latin alphabet, 10 > digits, and a range of punctuation and symbols. Historically, EBCDIC > has probably been popular on some systems. And in modern tools, UTF-8 > and Latin-1 (Windows CP1252, IIRC) are also common for the execution > character set (if not necessarily for the source character set). Those > use characters or encodings in the range 128-255 as well. All members of the basic execution character set (whose values are listed in 5.2.1) are required to have nonnegative values (N1570 6.2.5p3). The value of SCHAR_MAX is irrelevant; all such character must have values in the range 0..CHAR_MAX. For systems that use ASCII, this can be achieved by using CHAR_BIT==8 and making plain char either signed or unsigned. For EBCDIC-based systems, if CHAR_BIT==8 plain char must be unsigned. (An EBCDIC-based system with signed plain char and CHAR_BIT >= 9 is possible, but I seriously doubt that any such system exists.) [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"