Re: INT_MIN and compiler diagnostic



On 28 Feb, 12:34, pete <pfil...@xxxxxxxxxxxxxx> wrote:
bytebro wrote:
INT_MAX = 2147483647 INT_MIN = -2147483648
x = -2147483648 y = -2147483648

So amusingly, it tells me the constant is unsigned, then prints it
signed.

Where's a language lawyer when you need one?!

If INT_MAX equals 2147483647,
the the type of 2147483648 can't be type int, can it?

Erm... it doesn't say "2147483648", it says "-2147483648", which is
exactly equal to INT_MIN, and is therefore a valid int value. The
warning is therefore misleading, no?


.


Quantcast