Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.c > #387780

Re: What is your opinion about unsigned int u = -2 ?

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: What is your opinion about unsigned int u = -2 ?
Date 2024-08-25 14:28 -0700
Organization None to speak of
Message-ID <871q2cfg1p.fsf@nosuchdomain.example.com> (permalink)
References (9 earlier) <v8k21v$33nca$1@dont-email.me> <878qxefjk2.fsf@nosuchdomain.example.com> <v8k4i7$37tvs$1@dont-email.me> <87zfpue3bz.fsf@nosuchdomain.example.com> <6c6ncjt5eqpnslpu583hburcu6fkgl7g6a@4ax.com>

Show all headers | View raw


dave_thompson_2@comcast.net writes:
> On Fri, 02 Aug 2024 19:40:32 -0700, Keith Thompson
> <Keith.S.Thompson+u@gmail.com> wrote:
>> Thiago Adams <thiago.adams@gmail.com> writes:
>> > I think both cases (overflow and wraparound) should have warnings.
>> 
>> You're free to think that, of course, but wraparound behavior is well
>> defined and unambiguous.  I wouldn't mind an *optional* warning, but
>> plenty of programmers might deliberately write something like
>> 
>>     const unsigned int max = -1;
>> 
>> with the reasonable expectation that it will set max to INT_MAX.
>> 
> (cough) UINT_MAX (cough)

Quite right, thanks.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Find similar


Thread

Re: What is your opinion about unsigned int u = -2 ? Thiago Adams <thiago.adams@gmail.com> - 2024-08-02 22:03 -0300
  Re: What is your opinion about unsigned int u = -2 ? Thiago Adams <thiago.adams@gmail.com> - 2024-08-02 22:12 -0300
    Re: What is your opinion about unsigned int u = -2 ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-02 18:31 -0700
      Re: What is your opinion about unsigned int u = -2 ? Thiago Adams <thiago.adams@gmail.com> - 2024-08-02 22:50 -0300
        Re: What is your opinion about unsigned int u = -2 ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-02 19:29 -0700
          Re: What is your opinion about unsigned int u = -2 ? Thiago Adams <thiago.adams@gmail.com> - 2024-08-03 09:36 -0300
            Re: What is your opinion about unsigned int u = -2 ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-03 16:10 -0700
              Re: What is your opinion about unsigned int u = -2 ? Thiago Adams <thiago.adams@gmail.com> - 2024-08-03 22:46 -0300
                Re: What is your opinion about unsigned int u = -2 ? Thiago Adams <thiago.adams@gmail.com> - 2024-08-03 23:04 -0300
  Re: What is your opinion about unsigned int u = -2 ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-02 18:25 -0700
    Re: What is your opinion about unsigned int u = -2 ? Thiago Adams <thiago.adams@gmail.com> - 2024-08-02 22:44 -0300
      Re: What is your opinion about unsigned int u = -2 ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-02 19:04 -0700
        Re: What is your opinion about unsigned int u = -2 ? Thiago Adams <thiago.adams@gmail.com> - 2024-08-02 23:27 -0300
          Re: What is your opinion about unsigned int u = -2 ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-02 19:40 -0700
            Re: What is your opinion about unsigned int u = -2 ? David Brown <david.brown@hesbynett.no> - 2024-08-03 19:43 +0200
              Re: What is your opinion about unsigned int u = -2 ? Thiago Adams <thiago.adams@gmail.com> - 2024-08-03 14:46 -0300
                Re: What is your opinion about unsigned int u = -2 ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-03 16:52 -0700
            Re: What is your opinion about unsigned int u = -2 ? dave_thompson_2@comcast.net - 2024-08-25 16:52 -0400
              Re: What is your opinion about unsigned int u = -2 ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-25 14:28 -0700

csiph-web