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


Groups > comp.lang.c > #91566

Re: unsigned int

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: unsigned int
Date Tue, 02 Aug 2016 08:00:14 -0700
Organization None to speak of
Lines 39
Message-ID <lnmvkv2p35.fsf@kst-u.example.com> (permalink)
References <unsigned-20160731163521@ram.dialup.fu-berlin.de> <e06rglFmcd5U1@mid.individual.net> <nnn35u$2dd$1@dont-email.me> <nnnnqr$589$1@dont-email.me> <nnnpdf$b3s$1@dont-email.me> <nno33q$fto$1@dont-email.me> <87h9b4uy39.fsf@bsb.me.uk> <nnol7a$fk6$1@dont-email.me> <nnpl0b$p7u$1@dont-email.me> <nnqaph$ho$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="4654"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DoBA45O39+/3ajhSAxANu"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:4fw2CxK8ecIU/jAMKTqj9KQXjFM= sha1:FBY2X5tTuzEd8IovyLyMWnMvZsA=
Xref csiph.com comp.lang.c:91566

Show key headers only | View raw


Les Cargill <lcargill99@comcast.com> writes:
> David Brown wrote:
>> On 02/08/16 01:20, Les Cargill wrote:
[...]
>>> While it's implementation dependent, it's unusual for "unsigned" to be
>>> the actual default - unless overridden.
>>
>> I think that is a wild generalisation, without basis in fact - unless
>> you can point us to a list of compilers, targets, and the signedness of
>> their chars.
>
> Hence "unless overridden". The defacto, default standards for the 'C'
> language are "char is a smaller int" and "ints are signed by default."

char is not "a smaller int".  char and int are both integer types.
And yes, char is almost always smaller than int.

Yes, int is signed by default.  In fact, int is signed; it's not
just a default, it's a firm language rule.  Is that what you meant?

I think you meant to say, or imply, that plain char is signed by
default.  That statement is neither true nor useful.  And upthread,
you wrote the opposite (which is also misleading):

    Default char in 'C' is always unsigned unless you use compiler
    options to make it otherwise, or unless the compiler defaults it for
    you.

There is no default signedness for type char.  It is either signed or
unsigned, depending on the implementation.  It's probably true that
most modern hosted impleentations make plain char signed, but that
does not constitute a "default".  Code that's intended to be even
minimally portable must not depend on the signedness of plain char.

-- 
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