Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

It is not every question that deserves an answer. -- Publilius Syrus


devel / comp.lang.c / Re: uint8_t overflow in for ... loop

SubjectAuthor
* uint8_t overflow in for ... loopHowerd Oakford
+* Re: uint8_t overflow in for ... loopBart
|`* Re: uint8_t overflow in for ... loopHowerd Oakford
| `* Re: uint8_t overflow in for ... loopThiago Adams
|  `* Re: uint8_t overflow in for ... loopHowerd Oakford
|   +* Re: uint8_t overflow in for ... loopBen Bacarisse
|   |`- Re: uint8_t overflow in for ... loopGuillaume
|   `- Re: uint8_t overflow in for ... loopÖö Tiib
+* Re: uint8_t overflow in for ... loopDavid Brown
|+* Re: uint8_t overflow in for ... loopHowerd Oakford
||+* Re: uint8_t overflow in for ... loopDavid Brown
|||`- Re: uint8_t overflow in for ... loopHowerd Oakford
||+- Re: uint8_t overflow in for ... loopKeith Thompson
||`- Re: uint8_t overflow in for ... loopBen Bacarisse
|+* Re: uint8_t overflow in for ... loopMeredith Montgomery
||+* Re: uint8_t overflow in for ... loopScott Lurndal
|||+* Re: uint8_t overflow in for ... loopManfred
||||`* Re: uint8_t overflow in for ... loopTim Rentsch
|||| `* Re: uint8_t overflow in for ... loopManfred
||||  +- Re: uint8_t overflow in for ... loopKeith Thompson
||||  +- Re: uint8_t overflow in for ... loopDavid Brown
||||  `- Re: uint8_t overflow in for ... loopTim Rentsch
|||+* Re: uint8_t overflow in for ... loopKeith Thompson
||||`- Re: uint8_t overflow in for ... loopDavid Brown
|||`- Re: uint8_t overflow in for ... loopBonita Montero
||`* Re: uint8_t overflow in for ... loopDavid Brown
|| `* Re: uint8_t overflow in for ... loopMeredith Montgomery
||  `- Re: uint8_t overflow in for ... loopDavid Brown
|+* Re: uint8_t overflow in for ... loopManfred
||`- Re: uint8_t overflow in for ... loopDavid Brown
|`* Re: uint8_t overflow in for ... loopKeith Thompson
| `- Re: uint8_t overflow in for ... loopDavid Brown
`- Re: uint8_t overflow in for ... loopGuillaume

Pages:12
Re: uint8_t overflow in for ... loop

<87r1bqwirb.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18931&group=comp.lang.c#18931

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: uint8_t overflow in for ... loop
Date: Mon, 08 Nov 2021 11:27:04 -0800
Organization: None to speak of
Lines: 33
Message-ID: <87r1bqwirb.fsf@nosuchdomain.example.com>
References: <704c07ac-5bf1-4256-a82c-61088d1e00aan@googlegroups.com>
<smb6us$840$1@dont-email.me> <861r3q21lq.fsf@levado.to>
<JGaiJ.21677$Gco3.19158@fx01.iad> <smbef2$fa9$1@gioia.aioe.org>
<86a6iebiqg.fsf@linuxsc.com> <smbrft$18rg$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="8f220a377d54f8dc9b1bb1b71322e466";
logging-data="30573"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ksRcNlCzwY3nII+XZxQI4"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:zUeSANyHgdF9zJWd5ONaeoCK9lc=
sha1:c/b0PNobk57xZC4Pt3DFaFG57Z4=
 by: Keith Thompson - Mon, 8 Nov 2021 19:27 UTC

Manfred <noname@add.invalid> writes:
> On 11/8/2021 7:33 PM, Tim Rentsch wrote:
>> Manfred <noname@add.invalid> writes:
>>> If it "can never overflow", it's a statement that is clear enough.
>> Note that the original code doesn't have any computations
>> involving unsigned operands, only signed operands.
>
> On 08/11/2021 12:11, Howerd Oakford wrote:
>
>> uint8_t i;
>
>
> The code does
>> have /conversions/ from one integer type to another, but
>> conversions have their own rules, and no conversion between
>> integer types, either signed or unsigned or both, is "overflow"
>> in the sense that the C standard uses the term. Converting to
>> an unsigned type (from another integer type) is always exactly
>> defined by the C standard, depending only on the value being
>> converted and the implementation-defined width of the unsigned
>> type that is the target type of the conversion.

I can guess at the point you were trying to make, but it would be better
to be explicit rather than quoting snippets from previous posts.

Tim is correct. There is not addition of uint8_t values. The uint8_t
value is promoted to int, 1 is added to it, and the result is converted
back to uint8_t.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: uint8_t overflow in for ... loop

<smbufl$887$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18933&group=comp.lang.c#18933

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: uint8_t overflow in for ... loop
Date: Mon, 8 Nov 2021 20:40:36 +0100
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <smbufl$887$1@dont-email.me>
References: <704c07ac-5bf1-4256-a82c-61088d1e00aan@googlegroups.com>
<smb6us$840$1@dont-email.me> <861r3q21lq.fsf@levado.to>
<JGaiJ.21677$Gco3.19158@fx01.iad> <smbef2$fa9$1@gioia.aioe.org>
<86a6iebiqg.fsf@linuxsc.com> <smbrft$18rg$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 8 Nov 2021 19:40:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="34df53088790c71db89c3d94d2ab4515";
logging-data="8455"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+KJ2tnpIeZpEFQfvHGa4x3UKrru5GKpCA="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:VTbgsTUCS0vQ6piQRufg7PKdm00=
In-Reply-To: <smbrft$18rg$1@gioia.aioe.org>
Content-Language: en-GB
 by: David Brown - Mon, 8 Nov 2021 19:40 UTC

On 08/11/2021 19:49, Manfred wrote:
> On 11/8/2021 7:33 PM, Tim Rentsch wrote:
>> Manfred <noname@add.invalid> writes:
>
>>
>>> If it "can never overflow", it's a statement that is clear enough.
>>
>> Note that the original code doesn't have any computations
>> involving unsigned operands, only signed operands.
>
> On 08/11/2021 12:11, Howerd Oakford wrote:
>
>>     uint8_t i;
>
>
>   The code does

It has a variable of an unsigned type, but no arithmetic using unsigned
operations. For "i++", the "uint8_t" value is promoted to "int". Then
one is added to this int value, and then the result is converted back to
uint8_t. It might seem strange, but that's the way C works. (This has
the side-effect that a statement like "i++;" for signed int8_t types
will be defined behaviour - implementation-dependent, but almost
invariably wrapping.)

Re: uint8_t overflow in for ... loop

<smbv31$csb$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18934&group=comp.lang.c#18934

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: uint8_t overflow in for ... loop
Date: Mon, 8 Nov 2021 20:50:56 +0100
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <smbv31$csb$1@dont-email.me>
References: <704c07ac-5bf1-4256-a82c-61088d1e00aan@googlegroups.com>
<smb6us$840$1@dont-email.me> <861r3q21lq.fsf@levado.to>
<JGaiJ.21677$Gco3.19158@fx01.iad> <87bl2uxzgd.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 8 Nov 2021 19:50:57 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="34df53088790c71db89c3d94d2ab4515";
logging-data="13195"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vs1Nz2BHocSw2PcYCzDzvhJ2dV7zNCLM="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:AjCAwZA61oDi82eE1nwe42C6utI=
In-Reply-To: <87bl2uxzgd.fsf@nosuchdomain.example.com>
Content-Language: en-GB
 by: David Brown - Mon, 8 Nov 2021 19:50 UTC

On 08/11/2021 19:41, Keith Thompson wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>> Meredith Montgomery <mmontgomery@levado.to> writes:
>>> David Brown <david.brown@hesbynett.no> writes:
>>>
>>> [...]
>>>
>>>> The uint8_t variable counts up to 255, then wraps to 0 - overflow is
>>>> always wrapping for unsigned types (unlike for signed types).
>>>
>>> Technically the word is not ``overflow''.
>>
>> Technically, the processor sets the "overflow" flag. If that's not
>> an overflow, I'm not sure what it.
>
> Which processor? Who says it even has an overflow flag?
>

It is a ARM device. These have flags, including an overflow flag and a
carry flag (as Bonita pointed out, it would be the carry flag in this
case - the overflow flag is for signed arithmetic overflows).

However, as in many RISC architectures, updating the flags is optional
(using the ADDS instruction rather than ADD, IIRC) since flags are
scheduling bottlenecks. The compiler will not generate a flag-setting
ADD unless it needs one.

> In this context, "overflow" is determined by the C standard, not by the
> CPU.
>

Indeed.

Re: uint8_t overflow in for ... loop

<smbv72$csb$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18935&group=comp.lang.c#18935

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: uint8_t overflow in for ... loop
Date: Mon, 8 Nov 2021 20:53:06 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <smbv72$csb$2@dont-email.me>
References: <704c07ac-5bf1-4256-a82c-61088d1e00aan@googlegroups.com>
<smb6us$840$1@dont-email.me> <877ddixxqd.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 8 Nov 2021 19:53:06 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="34df53088790c71db89c3d94d2ab4515";
logging-data="13195"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bTdr8KIlH9aOxdSqyrc+9NwCydsajZDE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:hwcS5t3GCy1mwIxZKBRc9KnA13k=
In-Reply-To: <877ddixxqd.fsf@nosuchdomain.example.com>
Content-Language: en-GB
 by: David Brown - Mon, 8 Nov 2021 19:53 UTC

On 08/11/2021 20:18, Keith Thompson wrote:
> David Brown <david.brown@hesbynett.no> writes:
>> On 08/11/2021 12:11, Howerd Oakford wrote:
>>> Hi C-folks,
>>>
>>> Is the code listed below valid C?
>>> Specifically, is "i < 256" valid?
>>
>> It is valid, it is just not helpful. A uint8_t variable will /always/
>> be less than 256, so the check is always "true".
>>
>>>
>>> I ask this because i is an 8 bit unsigned integer, and I would like
>>> to know if it is legal to compare it with a value that is outside the
>>> range of i?
>>>
>>> Normally, I expect a for ... loop to count up to the value in the
>>> middle section, but in the case below it creates an infinite loop.
>>
>> The uint8_t variable counts up to 255, then wraps to 0 - overflow is
>> always wrapping for unsigned types (unlike for signed types).
>> Basically, you loop is like asking to run something every hour until 13
>> o'clock.
>
> That's essentially correct, but it's a bit more complicated for integer
> types narrower than int and unsigned int.
>
> You have:
>
> uint8_t i;
> ...
> i++
>
> C has no arithmetic operators for types narrower than int and unsigned
> int (and uint8_t is definitely narrower than int, since int is at least
> 16 bits).
>
> The expression `i++` is equivalent to `i = i + 1`. In `i + 1`, the
> value of i is promoted to int. The addition is then down on two
> operands of type int, and the result is assigned to i. Assigning an int
> value to a uint8_t object requires an implicit conversion. If the
> converted value can be represented in the target type (i.e., it's in the
> range 0..255), the conversion retains the same value. Otherwise, since
> the target type is an unsigned integer type, the conversion converts 256
> to 0. (It gets more complicated if the target type is a signed type
> like int8_t).
>
> The final result is the same as if it were operating directly on 8-bit
> values -- and the compiler might well generate code that does that if
> it's more efficient.
>

I know - but I didn't think the OP needed that level of detail. But if
he wants it, you've given an nice explanation of what is actually going on.

Re: uint8_t overflow in for ... loop

<86a6iezahc.fsf@levado.to>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18936&group=comp.lang.c#18936

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!3D/X0sRaL/x9kZJBo2b3aA.user.46.165.242.75.POSTED!not-for-mail
From: mmontgom...@levado.to (Meredith Montgomery)
Newsgroups: comp.lang.c
Subject: Re: uint8_t overflow in for ... loop
Date: Mon, 08 Nov 2021 16:57:35 -0300
Organization: Aioe.org NNTP Server
Message-ID: <86a6iezahc.fsf@levado.to>
References: <704c07ac-5bf1-4256-a82c-61088d1e00aan@googlegroups.com>
<smb6us$840$1@dont-email.me> <861r3q21lq.fsf@levado.to>
<smbff0$a59$3@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="38876"; posting-host="3D/X0sRaL/x9kZJBo2b3aA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:5lBthBspk8WQY6Vl358NDKTc/Hg=
 by: Meredith Montgomery - Mon, 8 Nov 2021 19:57 UTC

David Brown <david.brown@hesbynett.no> writes:

> On 08/11/2021 14:55, Meredith Montgomery wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>
>> [...]
>>
>>> The uint8_t variable counts up to 255, then wraps to 0 - overflow is
>>> always wrapping for unsigned types (unlike for signed types).
>>
>> Technically the word is not ``overflow''.
>
> Yes - you are technically correct. But at the the level of discussion
> that is most suitable for a thread like this, it is a useful term to
> describe what is happening. I don't think quoting the standard will
> help the OP.

I totally agree and my comment is not really for the OP. This is the
USENET, where sometimes an OP initiates a thread and people take it over
to just chat about whatever pleases them.

But, by the way, it does help the OP somewhat too. Even if the OP
doesn't understand the subject here, s/he gets a sense of the
complications that arise. (Tomorrow the OP might look up the word
overflow in an encyclopedia and check the standard to see if it
matches.)

Historically, comp.lang.c has always been more a group about the
standard than, say, practical c programming. Do you guys remember Dan
Pop? He used to amuse me. I like the language lawyers. I'm following
in their footsteps --- when I can, of course. It's fun.

Re: uint8_t overflow in for ... loop

<87fss6z9kj.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18938&group=comp.lang.c#18938

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: uint8_t overflow in for ... loop
Date: Mon, 08 Nov 2021 20:17:16 +0000
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <87fss6z9kj.fsf@bsb.me.uk>
References: <704c07ac-5bf1-4256-a82c-61088d1e00aan@googlegroups.com>
<smb6us$840$1@dont-email.me>
<4d3da41b-483d-4f1f-b169-b9bb76b23ca0n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="ae245c3fc7f87ec92e88ec1c6c67efcd";
logging-data="25929"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7EjjNyDkzz+AsncT3LhUpOoyCFGn2prw="
Cancel-Lock: sha1:bJIBaSaBAwFii53qrTZdTIQN29E=
sha1:HEwnuglm1jv0ukqPy+j9CzGiNyI=
X-BSB-Auth: 1.71dd184e4c34f64320fa.20211108201716GMT.87fss6z9kj.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 8 Nov 2021 20:17 UTC

Howerd Oakford <howerdo@gmail.com> writes:

> On Monday, November 8, 2021 at 1:59:20 PM UTC+1, David Brown wrote:

>> The big question is, why are you using "uint8_t" at all here?
> Company policy.

That's a shame. You can do this, of course,

uint8_t i = 0;
do {
// ... whatever ...
} while (i++ < UINT8_MAX);

but maybe company policy forbids this.

--
Ben.

Re: uint8_t overflow in for ... loop

<smc5g0$tmk$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18943&group=comp.lang.c#18943

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: uint8_t overflow in for ... loop
Date: Mon, 8 Nov 2021 22:40:16 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <smc5g0$tmk$1@dont-email.me>
References: <704c07ac-5bf1-4256-a82c-61088d1e00aan@googlegroups.com>
<smb6us$840$1@dont-email.me> <861r3q21lq.fsf@levado.to>
<smbff0$a59$3@dont-email.me> <86a6iezahc.fsf@levado.to>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 8 Nov 2021 21:40:16 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="34df53088790c71db89c3d94d2ab4515";
logging-data="30420"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8vMgSPn3l/HSkrKzF6bxgC0lJTNFO6q8="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:08CFxC88qeKz/8OMrqxFeTQBMsY=
In-Reply-To: <86a6iezahc.fsf@levado.to>
Content-Language: en-GB
 by: David Brown - Mon, 8 Nov 2021 21:40 UTC

On 08/11/2021 20:57, Meredith Montgomery wrote:
> David Brown <david.brown@hesbynett.no> writes:
>
>> On 08/11/2021 14:55, Meredith Montgomery wrote:
>>> David Brown <david.brown@hesbynett.no> writes:
>>>
>>> [...]
>>>
>>>> The uint8_t variable counts up to 255, then wraps to 0 - overflow is
>>>> always wrapping for unsigned types (unlike for signed types).
>>>
>>> Technically the word is not ``overflow''.
>>
>> Yes - you are technically correct. But at the the level of discussion
>> that is most suitable for a thread like this, it is a useful term to
>> describe what is happening. I don't think quoting the standard will
>> help the OP.
>
> I totally agree and my comment is not really for the OP. This is the
> USENET, where sometimes an OP initiates a thread and people take it over
> to just chat about whatever pleases them.

Fair enough. And the OP may want to understand things in more detail,
or compare with other sources. The percentage of C programmers who
regularly look at the C standards is, however, pretty small.

>
> But, by the way, it does help the OP somewhat too. Even if the OP
> doesn't understand the subject here, s/he gets a sense of the
> complications that arise. (Tomorrow the OP might look up the word
> overflow in an encyclopedia and check the standard to see if it
> matches.)
>
> Historically, comp.lang.c has always been more a group about the
> standard than, say, practical c programming. Do you guys remember Dan
> Pop? He used to amuse me. I like the language lawyers. I'm following
> in their footsteps --- when I can, of course. It's fun.
>

Re: uint8_t overflow in for ... loop

<865yt2b79q.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18947&group=comp.lang.c#18947

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: uint8_t overflow in for ... loop
Date: Mon, 08 Nov 2021 14:40:49 -0800
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <865yt2b79q.fsf@linuxsc.com>
References: <704c07ac-5bf1-4256-a82c-61088d1e00aan@googlegroups.com> <smb6us$840$1@dont-email.me> <861r3q21lq.fsf@levado.to> <JGaiJ.21677$Gco3.19158@fx01.iad> <smbef2$fa9$1@gioia.aioe.org> <86a6iebiqg.fsf@linuxsc.com> <smbrft$18rg$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="774f026e5366f2651c3ce55fa394a774";
logging-data="18405"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18k7KcGpLbSk/QN5SiM5STMVedjNX6n7Ms="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:XqxWx79kP+dY5tSqa8RWa3mEWMY=
sha1:whNzZs9mM3PrNmMpAgjOHFcs7Yg=
 by: Tim Rentsch - Mon, 8 Nov 2021 22:40 UTC

Manfred <noname@add.invalid> writes:

> On 11/8/2021 7:33 PM, Tim Rentsch wrote:
>
>> Manfred <noname@add.invalid> writes:
>>
>>> If it "can never overflow", it's a statement that is clear enough.
>>
>> Note that the original code doesn't have any computations
>> involving unsigned operands, only signed operands.
>
> On 08/11/2021 12:11, Howerd Oakford wrote:
>
>> uint8_t i;
>
> The code does

Sorry about this. I think of you as one of the language experts in
comp.lang.{c,c++} so I didn't think a more complete explanation
would be needed. The computational operands are signed because
the uint8_t variable is promoted to int before the operations
take place. I (wrongly) thought you would immediately understand
what I was getting at. Again, sorry for my misunderstanding.

(Despite the above, I still think it's better to err on the side
of overestimating people's abilities than to underestimate them.)

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor