I am using the mingw-w64 (x64) fork of minGW as prepared on nuwen.net. This is from the 7.1 version of gcc :
gcc --version
gcc (GCC) 7.1.0
PRIuPTR trick works (Cross platform format string for variables of type size_t?):
#include
#include
int main()
{
size_t a = (size_t)(1024ULL * 1024 * 1024 * 1024 + 13);
printf("a = %" PRIuPTR "\n", a);
printf("sizeof(size_t) = %" PRIuPTR "\n", sizeof(size_t));
printf("sizeof(uintptr_t) = %" PRIuPTR "\n", sizeof(uintptr_t));
return 0;
}
Output x86:
a = 13
sizeof(size_t) = 4
sizeof(uintptr_t) = 4
Output x64:
a = 1099511627789
sizeof(size_t) = 8
sizeof(uintptr_t) = 8