Re: INT_MIN and compiler diagnostic



In article <1172676891.968236.185190@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> "bytebro" <keith.willis@xxxxxxxxx> writes:
On 28 Feb, 13:20, Chris Dollin <chris.dol...@xxxxxx> wrote:
....
No.

`-2147483648` isn't a literal constant. It's an expression, the
negation of `2147483648`.
....
The thing is, in the OP's code lines 7 and 8, it says:

7 int y = -2147483648;
8 int x = INT_MIN;

which are _completely_ equivalent (INT_MIN is _defined_ as
-2147483648), and yet line 7 generates the warning:

Please check it. It will probably defined as (- 2147483647 - 1),
which is something different.
--
*** t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~***/
.


Quantcast