Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #91609

Re: unsigned int

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: unsigned int
Date 2016-08-03 08:58 -0700
Organization None to speak of
Message-ID <ln60rh3kuk.fsf@kst-u.example.com> (permalink)
References (9 earlier) <nnqaph$ho$1@dont-email.me> <nnqd6i$92c$1@dont-email.me> <nnqj06$u15$1@dont-email.me> <0584a001-91b8-48d9-80de-3c7db52f5aaa@googlegroups.com> <nnsmgd$gcm$1@dont-email.me>

Show all headers | View raw


David Brown <david.brown@hesbynett.no> 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  <http://www.ghoti.net/~kst>
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"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: unsigned int "Osmium" <r124c4u102@comcast.net> - 2016-07-31 12:40 -0500
  Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-01 11:01 +0200
    Re: unsigned int James Kuyper <jameskuyper@verizon.net> - 2016-08-01 10:15 -0400
    Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-01 09:59 -0500
      Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-01 17:21 +0200
        Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-01 09:55 -0700
          Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-01 22:42 +0200
            Re: unsigned int supercat@casperkitty.com - 2016-08-01 14:18 -0700
        Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-01 13:11 -0500
          Re: unsigned int Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-01 19:46 +0100
            Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-01 18:20 -0500
              Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-02 10:18 +0200
                Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-02 09:35 -0500
                Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-02 08:00 -0700
                Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-02 11:12 -0500
                Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-02 17:11 +0200
                Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-02 11:55 -0500
                Re: unsigned int supercat@casperkitty.com - 2016-08-02 10:16 -0700
                Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-03 14:02 +0200
                Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-03 08:58 -0700
                Re: unsigned int James Kuyper <jameskuyper@verizon.net> - 2016-08-02 13:57 -0400
                Re: unsigned int Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-02 19:30 +0100
                Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-02 11:38 -0700
                Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-03 14:12 +0200
                Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-03 13:45 +0200
          Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-01 12:02 -0700
            Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-01 23:01 +0200

csiph-web