4 ms·
Yeah, it's ugly, but it's sadly the only way to correctly do cross platform prints where the type may or may not be 64 bit.
by __david__ 11y ago
Yeah, it's ugly, but it's sadly the only way to correctly do cross platform prints where the type may or may not be 64 bit.
- _kst_ 11y agoThe `PRIuMAX` macro in particular is not necessary. It expands to a format usable for `uintmax_t`, but you can also use `"%ju"`. Both were introduced in ISO C99. (Unless your `printf` implementation doesn't recognize `"%ju"`, and the `PRIuMAX` macro and friends are defined in some non-standard system-specific manner.)
- e12e 11y agoRelated, the recently posted "How to write C in 2016": https://news.ycombinator.com/item?id=10864176 https://news.ycombinator.com/item?id=10864176