Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/external/bsd/dhcpcd/dist/src



On 03/08/2018 23:03, Valery Ushakov wrote:
On Fri, Aug 03, 2018 at 18:08:24 +0300, Valery Ushakov wrote:

On Fri, Aug 03, 2018 at 15:54:24 +0200, Martin Husemann wrote:

On Fri, Aug 03, 2018 at 08:28:55PM +0700, Robert Elz wrote:
Where is the signed arithmetic that was supposedly a probem?

Ah, stupid C integer promotion rules.  uint16_t is promoted to int
here, not unsigned int or size_t.

Hmm, i don't think that's true.

Nah, you are right.  "THEN" is the important word here.

But as it transpired in another branch of this thread the problem was
something entirely different...

   6.3.1.8  Usual arithmetic conversions

   ...
             Otherwise, the integer promotions are performed on both
             operands.   Then the following rules are applied to the
             promoted operands:

So casting to (size_t) is the Right Thing To Do and no comment required?

Roy


Home | Main Index | Thread Index | Old Index