| Deutsch English Français Italiano |
|
<871q2cfg1p.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
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: Sun, 25 Aug 2024 14:28:34 -0700
Organization: None to speak of
Lines: 21
Message-ID: <871q2cfg1p.fsf@nosuchdomain.example.com>
References: <pan$d2c8a$8c54ac9f$29a202e0$12c6ce86@invalid.invalid>
<87bk2cecan.fsf@bsb.me.uk> <v8inds$2qpqh$1@dont-email.me>
<v8iqnr$7l3c$1@news.xmission.com> <v8irje$2rolg$1@dont-email.me>
<87r0b6g3qx.fsf@nosuchdomain.example.com>
<v8jbj5$2us0r$4@dont-email.me> <v8jvln$33atp$1@dont-email.me>
<87h6c2fldh.fsf@nosuchdomain.example.com>
<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>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sun, 25 Aug 2024 23:28:35 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="40ee2afb4f283fffad3dfce85eeabfde";
logging-data="2207701"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19N9adVOqyYFPC6T0FleEpD"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:0e9wNIfwyN7zOjTWF6lj623uAaY=
sha1:AtjTa4nKCBrOOTgFcY5nWkuRffY=
Bytes: 2230
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 */