Re: INT_MIN and compiler diagnostic



bytebro wrote:

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?

No.

`-2147483648` isn't a literal constant. It's an expression, the
negation of `2147483648`.

--
Chris "electric hedgehog" Dollin
"People are part of the design. It's dangerous to forget that." /Star Cops/

.



Relevant Pages

  • Re: INT_MIN and compiler diagnostic
    ... the the type of 2147483648 can't be type int, ... and is therefore a valid int value. ... winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131 ...
    (comp.lang.c)
  • Re: INT_MIN and compiler diagnostic
    ... the the type of 2147483648 can't be type int, ... and is therefore a valid int value. ... warning is therefore misleading, no? ...
    (comp.lang.c)
  • Re: INT_MIN and compiler diagnostic
    ... bytebro wrote: ... Where's a language lawyer when you need one?! ... If INT_MAX equals 2147483647, ... the the type of 2147483648 can't be type int, ...
    (comp.lang.c)