From: a.biardi@tiscali.it
To: linux-c-programming@vger.kernel.org
Subject: decimal constant so large?
Date: Sat, 28 May 2005 18:50:57 +0100 [thread overview]
Message-ID: <200505281850.57908.a.biardi@tiscali.it> (raw)
Hi everybody,
Can anyone tell me why the constant -2147483648, according to what g++ reports
as a warning for the code below, is considered to be "so large that it is
unsigned"?
How can it be unsigned when it starts with '-'?
I am compiling on an x86, and the constant seems to be a perfectly good 32 bit
signed value to me. Where am I wrong?
I've tried it with three different compilers, and they all behave in the same
funny way: Borland C++ compiler 5.7, as well as g++ 3.2.3 report a warning,
Intel compiler 8.1 says nothing.
==============================================================================
#include <iostream>
using namespace std;
int main() {
cout << (int)-2147483648 << endl; // ok
cout << -2147483648 << endl; // prints 2147483648 instead
}
==============================================================================
next reply other threads:[~2005-05-28 17:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-28 17:50 a.biardi [this message]
2005-05-31 13:15 ` decimal constant so large? Glynn Clements
2005-05-31 23:15 ` Training Darren Sessions
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200505281850.57908.a.biardi@tiscali.it \
--to=a.biardi@tiscali.it \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).