Re: 64 bit numbers vs format strings
Melanie Plageman <melanieplageman@gmail.com>
From: Melanie Plageman <melanieplageman@gmail.com>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Peter Eisentraut <peter@eisentraut.org>
Date: 2024-12-06T00:15:32Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Cast result of i64abs() back to int64
- 2247281c4705 18.0 landed
On Thu, Dec 5, 2024 at 5:12 PM Thomas Munro <thomas.munro@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