#include <limits>
#include <iostream>
using namespace std;
// http://www.who.is.free.fr/wiki/doku.php?id=type
// g++ -O0 main.cpp -o main
// g++ -O1 main.cpp -o main
int main()
{
cout << hex << std::numeric_limits<int32_t>::max() << endl; // 7fffffff
cout << hex << (int32_t) ((float) std::numeric_limits<int32_t>::max()) << endl; // 80000000
cout << hex << (int32_t) (static_cast<float>(std::numeric_limits<int32_t>::max())) << endl; // 80000000
cout << hex << (int32_t) (static_cast<float>(std::numeric_limits<float>::max())) << endl; // 80000000
printf("0x%x\n", (int) (float) 0x80000000); //0x7fffffff
}
To ExplaiN LimitS CasT