On Thu, Dec 5, 2024 at 5:12 PM Thomas Munro <thomas.mu...@gmail.com> wrote:
>
> Having learned some things about gettext based on clues[1] from Peter
> E, I decided to see what it would take to expunge all (long long) and
> similar casts now that we're using the standard types with system
> support.
>
> The short version is tha given uint64 x:
>
>     Old: errmsg("hello %llu", (unsigned long long) x)
>     New: errmsg("hello %" PRIu64, x)
>
> (And all other printf-like interfaces).  That d can be x, X, u, etc
> and you can put the usual stuff between % and the macro, so it's cut
> up slightly differently than our own macros for that stuff.

Yay!

I didn't look at the pgbench bits and don't know the answer to any of
the questions you asked in your mail (re difficulty introduced when
backporting etc), but big +1 from me on doing this.

So, will this fix the issue that when I do:

uint64 somevar = 0;
errmsg("hello %lu", somevar)

locally on my x86-64 linux machine running ubuntu with whatever gcc-11
comes out of the box, it compiles sans warnings, but in the
mingw_cross_warning task in CI, it warns with:

error: format ‘%lu’ expects argument of type ‘long unsigned int’, but
argument 2 has type ‘uint64’ {aka ‘long long unsigned int’}

- Melanie


Reply via email to