{"thread":{"id":"52754","subject":"Printing a uint64_t portably in Git?","startedAt":"2020-02-06T17:52:30Z","lastAt":"2020-02-06T21:11:26Z","messageCount":5,"participants":["Han-Wen Nienhuys","Martin Ågren","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"391258","messageId":"CAFQ2z_Pac6yb9Vi782VMtPkssNmdc08WntS7xRt8KCFfM6KVsw@mail.gmail.com","threadId":"52754","inReplyTo":null,"subject":"Printing a uint64_t portably in Git?","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@google.com","sentAt":"2020-02-06T17:52:14Z","receivedAt":"2020-02-06T17:52:30Z","isPatch":false,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"Hi,\n\nThe reftable patch is starting to shape up, but I still see failures on OSX,\n\nSee https://dev.azure.com/gitgitgadget/git/_build/results?buildId=29465&view=logs&j=cfa20e98-6997-523c-4233-f0a7302c929f&t=3de1ae02-4adb-5138-54da-65cec5dd3141&l=518\n\nWhat is the right incantation to do printf of a uint64_t on OSX ?\n\nApparently PRIuMAX is to be used for \"uintmax_t\", and not for \"long\nlong unsigned int\".\n\n-- \nHan-Wen Nienhuys - Google Munich\nI work 80%. Don't expect answers from me on Fridays.\n--\n\nGoogle Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich\n\nRegistergericht und -nummer: Hamburg, HRB 86891\n\nSitz der Gesellschaft: Hamburg\n\nGeschäftsführer: Paul Manicle, Halimah DeLaine Prado\n"},{"id":"391259","messageId":"CAN0heSqoU1NxOtwaE_ZBBzghLXAeC4CxVh1x8R-efOVtbHdA5g@mail.gmail.com","threadId":"52754","inReplyTo":"CAFQ2z_Pac6yb9Vi782VMtPkssNmdc08WntS7xRt8KCFfM6KVsw@mail.gmail.com","subject":"Re: Printing a uint64_t portably in Git?","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2020-02-06T18:00:02Z","receivedAt":"2020-02-06T18:00:15Z","isPatch":false,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"On Thu, 6 Feb 2020 at 18:54, Han-Wen Nienhuys <hanwen@google.com> wrote:\n> What is the right incantation to do printf of a uint64_t on OSX ?\n>\n> Apparently PRIuMAX is to be used for \"uintmax_t\", and not for \"long\n> long unsigned int\".\n\nYou could cast it? Grepping around, that seems to be how PRIuMAX is\nused:\n\n  printf(\"%\"PRIuMAX\"\\n\", (uintmax_t)var);\n\nMartin\n"},{"id":"391263","messageId":"CAFQ2z_Mez4khfvXx6R2K9JPagmoQWD-ZnT7rFiAW9Avjt=4PpQ@mail.gmail.com","threadId":"52754","inReplyTo":"CAN0heSqoU1NxOtwaE_ZBBzghLXAeC4CxVh1x8R-efOVtbHdA5g@mail.gmail.com","subject":"Re: Printing a uint64_t portably in Git?","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@google.com","sentAt":"2020-02-06T19:15:02Z","receivedAt":"2020-02-06T19:15:18Z","isPatch":false,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"On Thu, Feb 6, 2020 at 7:00 PM Martin Ågren <martin.agren@gmail.com> wrote:\n>\n> On Thu, 6 Feb 2020 at 18:54, Han-Wen Nienhuys <hanwen@google.com> wrote:\n> > What is the right incantation to do printf of a uint64_t on OSX ?\n> >\n> > Apparently PRIuMAX is to be used for \"uintmax_t\", and not for \"long\n> > long unsigned int\".\n>\n> You could cast it? Grepping around, that seems to be how PRIuMAX is\n> used:\n>\n>   printf(\"%\"PRIuMAX\"\\n\", (uintmax_t)var);\n\nLooks like the inttypes.h standard has the defines that I want.\n\n-- \nHan-Wen Nienhuys - Google Munich\nI work 80%. Don't expect answers from me on Fridays.\n--\n\nGoogle Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich\n\nRegistergericht und -nummer: Hamburg, HRB 86891\n\nSitz der Gesellschaft: Hamburg\n\nGeschäftsführer: Paul Manicle, Halimah DeLaine Prado\n"},{"id":"391270","messageId":"CAN0heSrOvAdXs-8n0Cz4NMHqoxYfpStUOZcPRT1iQnA3R1srbQ@mail.gmail.com","threadId":"52754","inReplyTo":"CAFQ2z_Mez4khfvXx6R2K9JPagmoQWD-ZnT7rFiAW9Avjt=4PpQ@mail.gmail.com","subject":"Re: Printing a uint64_t portably in Git?","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2020-02-06T19:52:48Z","receivedAt":"2020-02-06T19:53:02Z","isPatch":false,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"On Thu, 6 Feb 2020 at 20:15, Han-Wen Nienhuys <hanwen@google.com> wrote:\n>\n> On Thu, Feb 6, 2020 at 7:00 PM Martin Ågren <martin.agren@gmail.com> wrote:\n> >\n> > On Thu, 6 Feb 2020 at 18:54, Han-Wen Nienhuys <hanwen@google.com> wrote:\n> > > What is the right incantation to do printf of a uint64_t on OSX ?\n> > >\n> > > Apparently PRIuMAX is to be used for \"uintmax_t\", and not for \"long\n> > > long unsigned int\".\n> >\n> > You could cast it? Grepping around, that seems to be how PRIuMAX is\n> > used:\n> >\n> >   printf(\"%\"PRIuMAX\"\\n\", (uintmax_t)var);\n>\n> Looks like the inttypes.h standard has the defines that I want.\n\nOh, cool. We handle PRIuMAX and PRId64 in compat/mingw.h, but other than\nthat, it seems we rely on these being available. There's some discussion\nin ebc3278665 (\"git-compat-util.h: drop the `PRIuMAX` and other fallback\ndefinitions\", 2019-11-24).\n\nMartin\n"},{"id":"391275","messageId":"xmqqk14ze806.fsf@gitster-ct.c.googlers.com","threadId":"52754","inReplyTo":"CAN0heSqoU1NxOtwaE_ZBBzghLXAeC4CxVh1x8R-efOVtbHdA5g@mail.gmail.com","subject":"Re: Printing a uint64_t portably in Git?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-02-06T21:11:21Z","receivedAt":"2020-02-06T21:11:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Ågren <martin.agren@gmail.com> writes:\n\n> On Thu, 6 Feb 2020 at 18:54, Han-Wen Nienhuys <hanwen@google.com> wrote:\n>> What is the right incantation to do printf of a uint64_t on OSX ?\n>>\n>> Apparently PRIuMAX is to be used for \"uintmax_t\", and not for \"long\n>> long unsigned int\".\n>\n> You could cast it? Grepping around, that seems to be how PRIuMAX is\n> used:\n>\n>   printf(\"%\"PRIuMAX\"\\n\", (uintmax_t)var);\n\nYup, that is used already in existing code in our codebase, so it is\njust as portable as the rest of Git is ;-)\n\nThanks.\n"}]}