Re: INT_MIN and compiler diagnostic
- From: Chris Dollin <chris.dollin@xxxxxx>
- Date: Wed, 28 Feb 2007 13:20:04 +0000
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/
.
- Follow-Ups:
- Re: INT_MIN and compiler diagnostic
- From: bytebro
- Re: INT_MIN and compiler diagnostic
- References:
- Re: INT_MIN and compiler diagnostic
- From: bytebro
- Re: INT_MIN and compiler diagnostic
- From: pete
- Re: INT_MIN and compiler diagnostic
- From: bytebro
- Re: INT_MIN and compiler diagnostic
- Prev by Date: Re: Source Code for C Unleashed
- Next by Date: Re: INT_MIN and compiler diagnostic
- Previous by thread: Re: INT_MIN and compiler diagnostic
- Next by thread: Re: INT_MIN and compiler diagnostic
- Index(es):
Relevant Pages
|