3 ms·
> "How do you portably printf() an integer type that you don’t (and can’t) know the size of" "Portably" across what? You need to narrow down the problem space
by csmpltn 4y ago
> "How do you portably printf() an integer type that you don’t (and can’t) know the size of"
"Portably" across what? You need to narrow down the problem space and better define it.
If it's portably across a myriad of processor architectures, hardware profiles and operating systems then you would need to take the intermediate representation route (like Java). There's very little else that can be done in the face of infinite, non-compatible ABIs at every layer.
- teddyh 4y agoI mean portable over all platforms which claims to support standard C. > you would need to take the intermediate representation route (like Java). There's very little else that can be done in the face of infinite, non-compatible ABIs at every layer. No, I don’t think so. There’s an obvious solution, dictated by the architectual choices made by C (i.e. every architecture which introduces a new larger integer type, by necessity redefines intmax_t, and creates a new ABI), but the community (for reasons of their own) did not want to do it that way, and instead broke the promise of intmax_t always being the largest type.