3 ms·
Just FYI -- there are macros for the fixed-length types, e.g.: printf("U32: %" PRIu23 ", U64: " PRId64, (uint32_t)1, (int64_t)2); Perhaps not as handy as
by rmind 6y ago
Just FYI -- there are macros for the fixed-length types, e.g.:
printf("U32: %" PRIu23 ", U64: " PRId64, (uint32_t)1, (int64_t)2);
Perhaps not as handy as %u32 or %s64, but it's here.
- deleted 6y ago[deleted]
- emilfihlman 6y agoYeah, and the issue is with those macros exactly. It makes writing code on them really damn annoying and it relies on C constant string concatenation, breaks the flow quite a lot.
- _kst_ 6y agoWhich is why I usually convert to intmax_t or uintmax_t, or to some type that I know is wide enough: uint64_t foo = ...; printf("foo = %ju\n", (uintmax_t)foo); /* OR */ printf("foo = %llu\n", (unsigned long long)foo);
- michaelt 6y agoI think what emilfihlman means is those macros are hard to remember and clumsy to use - which you might agree with when I point out you made two mistakes in two usages :-p