On Sun, Jan 10, 2021 at 4:59 AM Dimitry Andric <[email protected]> wrote: > > On 8 Jan 2021, at 23:53, Cy Schubert <[email protected]> wrote: > > > > In message <[email protected] > > om> > > , Chuck Tuffli writes: > >> --000000000000c9481f05b86a0c60 > >> Content-Type: text/plain; charset="UTF-8" > >> > >> On Fri, Jan 8, 2021 at 11:27 AM Cy Schubert <[email protected]> > >> wrote: > >> > >>> In message <[email protected]>, Cy Schubert > >>> writes: > >>>> In message <[email protected]>, Jessica > >>>> Clarke w > >>>> rites: > >>> > >> ... > >> > >>>>> This broke powerpc and powerpc64: > >> > >> > >> Sorry about that. I'll fix this in a bit. > >> > >> --chuck > > > > Looks like dim@ already did. > > > > The time before last I fixed one of these it was pointed out to me > > privately that when we use %jd that we should also cast to intmax_t or > > uintmax_t, and that jhb@ told him. This was to future-proof, assuming we'd > > have 128-bit processors one day. > > That is certainly valid for e.g. time_t or other types with a varying > width, or where you cannot predict the exact width. > > But for printing uint64_t and friends, where the width *is* exactly > specified, I would rather just use the standards-defined PRIu64 and so > on. Casting will obscure any type mismatches between the printf format > strings and the actual arguments. > > -Dimitry >
This is technically right, but it's just so ugly and so much harder to read, especially with multiple format arguments. IMHO, casting to max width is acceptable. _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "[email protected]"
