Re: Printing a uint64_t portably in Git?
- From
- Martin Ågren <martin.agren@gmail.com>
- Date
- Feb 6, 2020, 19:52 UTC
- Message-ID
- <CAN0heSrOvAdXs-8n0Cz4NMHqoxYfpStUOZcPRT1iQnA3R1srbQ@mail.gmail.com>
- In-Reply-To
- <CAFQ2z_Mez4khfvXx6R2K9JPagmoQWD-ZnT7rFiAW9Avjt=4PpQ@mail.gmail.com>
On Thu, 6 Feb 2020 at 20:15, Han-Wen Nienhuys <hanwen@google.com> wrote:
Show 15 quoted lines
>
> On Thu, Feb 6, 2020 at 7:00 PM Martin Ågren <martin.agren@gmail.com> wrote:
> >
> > On Thu, 6 Feb 2020 at 18:54, Han-Wen Nienhuys <hanwen@google.com> wrote:
> > > What is the right incantation to do printf of a uint64_t on OSX ?
> > >
> > > Apparently PRIuMAX is to be used for "uintmax_t", and not for "long
> > > long unsigned int".
> >
> > You could cast it? Grepping around, that seems to be how PRIuMAX is
> > used:
> >
> > printf("%"PRIuMAX"\n", (uintmax_t)var);
>
> Looks like the inttypes.h standard has the defines that I want.Oh, cool. We handle PRIuMAX and PRId64 in compat/mingw.h, but other than that, it seems we rely on these being available. There's some discussion in ebc3278665 ("git-compat-util.h: drop the `PRIuMAX` and other fallback definitions", 2019-11-24).
Martin