by hazeii · 6y ago · 0 comments
printf("here's your int64_t: %ld\n", x);
printf("here's your int64_t: %lld\n", x);
And the portable way using inttypes.h is really ugly: printf("portably int64_t: %" PRId64 "\n", x);
There's another religious argument to be had over size_t vs ssize_t, but that can wait :-)The default integer types have not aged well...
This bothers me less because I can always cast it up:
fprintf(logfile, "pid: %lld", (long long)pid);
Technically not portable, but find a platform with PIDs where this breaks. You can count on long long being at least 64 bits, and I think it'll be a while before we need 128 bit process IDs. :-)> The default integer types have not aged well...
To me, the real pisser is that every compiler copped out and decided to leave int at 32 bits when the architecture advanced to 64 bits. Part of the reason for compilers exploiting "signed can't overflow" is so they can work around for loops with 32 bit int variables, and this has ugly consequences because most of the conversion rules in C are defined with respect to int.
And honestly, Microsoft should burn for leaving long at 32 bits.