On Mon, 21 Jan 2019, Dariusz Sendkowski wrote:
> Wouldn't it lead to undefined behavior?
> According to the standard: "... The value of the result of an integer
> arithmetic or conversion function cannot be represented (7.8.2.1, 7.8.2.2,
> 7.8.2.3, 7.8.2.4, 7.22.6.1, 7.22.6.2, 7.22.1) ..."
> This
Wouldn't it lead to undefined behavior?
According to the standard: "... The value of the result of an integer
arithmetic or conversion function cannot be represented (7.8.2.1, 7.8.2.2,
7.8.2.3, 7.8.2.4, 7.22.6.1, 7.22.6.2, 7.22.1) ..."
This dump case is not compiled with -fwrapv flag, so I guess it
Hi,
This code is buggy, since subtraction and then casting to int will not
produce the right result if the values are too far apart.
There must be more like this in the tree any volunteers?
In general, you don't want to do subtraction, even for ints. For
example: compare INT_MIN and 1. INT_