#include <cstdint>
#include <iostream>
using namespace std;
int main()
{
cout << sizeof(INT8_C (42)) << " "; // 4
cout << sizeof(INT16_C (42)) << " "; // 4
cout << sizeof(INT32_C (42)) << " "; // 4
cout << sizeof(INT64_C (42)) << " "; // 8
cout << sizeof(INTMAX_C (42)) << " "; // 8
cout << sizeof(UINT8_C (42)) << " "; // 4
cout << sizeof(UINT16_C (42)) << " "; // 4
cout << sizeof(UINT32_C (42)) << " "; // 4
cout << sizeof(UINT64_C (42)) << " "; // 8
cout << sizeof(UINTMAX_C(42)) << " "; // 8
cout << endl;
return 0;
}
// Output: 4 4 4 8 8 4 4 4 8 8
Reference: http://en.cppreference.com/w/cpp/types/integerMonday, November 27, 2017
C++11: Fixed Width Integer Macro Functions for Minimum Width Constants
C++11 added fixed width integer macro functions for minimum width constants. Here is an example:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment