Checking the limits of the type long long using
std::cout << std::numeric_limits<long long>::min();
I get -9223372036854775808
However when compiling the following code:
int main() {
long long l;
l=-9223372036854775808LL;
}
I get the warnings:
test.cpp:3:7: warning: integer constant is so large that it is unsigned.
test.cpp:3: warning: this decimal constant is unsigned only in ISO C90
What am I missing?
Many thanks in advance for your help.
Giorgio
This
9223372036854775808LLis a positive number. So you need to takeinto consideration. Negating it immediately afterwards doesn’t make the operand of the
-operator itself negative.