Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jan 2021 12:41:18 -0800
From:      Ryan Libby <rlibby@freebsd.org>
To:        Dimitry Andric <dim@freebsd.org>
Cc:        Cy Schubert <Cy.Schubert@cschubert.com>, Chuck Tuffli <chuck@freebsd.org>,  Jessica Clarke <jrtc27@freebsd.org>,  "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>,  "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>,  "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page
Message-ID:  <CAHgpiFyXwi7OZS7GcRMkw65onjepH2XSU53-Ly_YvrY0pj6k6A@mail.gmail.com>
In-Reply-To: <2B913109-27A8-4ABF-8F64-48CE78B76759@FreeBSD.org>
References:  <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> <202101081920.108JKUd2003299@slippy.cwsent.com> <202101081927.108JRKxR084004@slippy.cwsent.com> <CAKAYmMLD5F7C_kBSVJ6vXgGmBFDK_J4053WeMSOJK07P-VQ_8g@mail.gmail.com> <202101082253.108MrrUL003251@slippy.cwsent.com> <2B913109-27A8-4ABF-8F64-48CE78B76759@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

On Sun, Jan 10, 2021 at 4:59 AM Dimitry Andric <dim@freebsd.org> wrote:
>
> On 8 Jan 2021, at 23:53, Cy Schubert <Cy.Schubert@cschubert.com> wrote:
> >
> > In message <CAKAYmMLD5F7C_kBSVJ6vXgGmBFDK_J4053WeMSOJK07P-VQ_8g@mail.gmail.c
> > om>
> > , Chuck Tuffli writes:
> >> --000000000000c9481f05b86a0c60
> >> Content-Type: text/plain; charset="UTF-8"
> >>
> >> On Fri, Jan 8, 2021 at 11:27 AM Cy Schubert <Cy.Schubert@cschubert.com>
> >> wrote:
> >>
> >>> In message <202101081920.108JKUd2003299@slippy.cwsent.com>, Cy Schubert
> >>> writes:
> >>>> In message <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org>, 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.


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHgpiFyXwi7OZS7GcRMkw65onjepH2XSU53-Ly_YvrY0pj6k6A>