So I was doing some testing with the new data type long long when I stumbled upon a little "problem" (example came from C++ Primer 6th edition). I was using the climits library to tell me the maximum number supported by long and long long and both came out to 9223372036854775807. How is that possible?
#include <iostream>
#include <climits>
int main()
{
std::cout << "int size is " << sizeof(int) << " bytes." << std::endl;
std::cout << "short size is " << sizeof(short) << " bytes." << std::endl;
std::cout << "long size is " << sizeof(long) << " bytes." << std::endl;
std::cout << "long long size is " << sizeof(long long) << " bytes." << std::endl;
std::cout << "Maximum values: " << std::endl;
std::cout << "int: " << INT_MAX << std::endl;
std::cout << "short: " << SHRT_MAX << std::endl;
std::cout << "long: " << LONG_MAX << std::endl;
std::cout << "long long: " << LLONG_MAX << std::endl;
return 0;
}