With std::cout, it prints positive

by qbguy (no login)

#include <iostream>

int main ()
{
std :: cout << -2147483648 << std :: endl;
return 0;
}

Supposedly, this is correct behavior in ISO C and C++ according to http://gcc.gnu.org/onlinedocs/gcc/Incompatibilities.html

On a 64-bit system, it might print it as negative because on a 64-bit system, an int would be 64-bits (?)

Supposedly, in C99, -2147483648 is negative, because 2147483648 has type 'long long'.



Posted on Apr 7, 2008, 4:50 PM
from IP address 76.195.133.68

Respond to this message   

Return to Index


Response TitleAuthor and Date
gcc defaults to C89, and C++98 isn't any better regarding this aspect.rpgfan3233 on Apr 7