/* confdefs.h */ #define UINT64_FORMAT "%llu" /* end confdefs.h. */ #include #include int main() { char buf64[100]; char bufz[100]; /* * Check whether we print correctly using %z by printing the biggest * unsigned number fitting in a size_t and using both %zu and the format for * 64bit numbers. */ snprintf(bufz, 100, "%zu", ~(size_t)0); snprintf(buf64, 100, UINT64_FORMAT, ~(size_t)0); if (strcmp(bufz, buf64) != 0) fprintf(stderr, "no can do %%z\n"); else fprintf(stderr, "can do %%z\n"); }