Q: What printf format should I use for a typedef like size_t when I don't know whether it's long or some other type?
A: Use a cast to convert the value to a known, conservatively-sized type, then use the printf format matching that type. For example, to print the size of a type, you might use
printf("%lu", (unsigned long)sizeof(thetype));