Skip to content

Instantly share code, notes, and snippets.

@xoolive
Created February 18, 2016 23:11
Show Gist options
  • Save xoolive/7b2fdc7dd561e0f5058d to your computer and use it in GitHub Desktop.
Save xoolive/7b2fdc7dd561e0f5058d to your computer and use it in GitHub Desktop.
Check int64_t size with your compiler
#include <iostream>
#include <cstdint>
template <typename T>
bool is_int64() { return false; }
template <>
bool is_int64<int64_t>() { return true; }
int main()
{
std::cout << "int:\t" << is_int64<int>() << std::endl;
std::cout << "int64_t:\t" << is_int64<int64_t>() << std::endl;
std::cout << "long int:\t" << is_int64<long int>() << std::endl;
std::cout << "long long int:\t" << is_int64<long long int>() << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment