Re: INT_MIN and compiler diagnostic



On 28 Feb, 10:07, p_cricket_...@xxxxxxxxxxx wrote:
When I compile this using gcc, I get a diagnostic on line 7:

[pcg@mylinux test]$gcc -ansi -pedantic -Wall -o /tmp/x /tmp/x.c
/tmp/x.c: In function `main':
/tmp/x.c:7: warning: this decimal constant is unsigned only in ISO C90

On mine (Sun sparc) using gcc with exactly the same flags I get

x.c:7: warning: decimal constant is so large that it is unsigned

The program output is:

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?!

.



Relevant Pages

  • Re: decimal constant too large
    ... int main ... Produces the following warning: ... `-2147483648` isn't a decimal constant; ... expressed in a 32-bit signed integer. ...
    (comp.lang.c)
  • Re: decimal constant too large
    ... int main{ ... Produces the following warning: ... temp.c:3: warning: decimal constant is so large that it is unsigned ... The positive integer doesn't fit. ...
    (comp.lang.c)
  • decimal constant too large
    ... int main ... Produces the following warning: ... temp.c:3: warning: decimal constant is so large that it is unsigned ... I checked the FAQ but didn't see anything. ...
    (comp.lang.c)
  • Re: decimal constant too large
    ... kerravon wrote: ... int main ... Produces the following warning: ... temp.c:3: warning: decimal constant is so large that it is unsigned ...
    (comp.lang.c)
  • Re: decimal constant too large
    ... environments and therefore the constant fits into a signed integer and ... therefore I shouldn't be getting a warning. ... `-2147483648` isn't a decimal constant; ... expressed in a 32-bit signed integer. ...
    (comp.lang.c)