From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org> |
Subject: | Re: 64 bit numbers vs format strings |
Date: | 2024-12-06 00:15:32 |
Message-ID: | CAAKRu_Z6LAYS_wz45JwBBfBr6Mbt=D0S4BL+H551i0dBgDkKRg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Dec 5, 2024 at 5:12 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Melanie Plageman | 2024-12-06 00:32:19 | Re: Count and log pages set all-frozen by vacuum |
Previous Message | Tom Lane | 2024-12-05 23:34:31 | Re: attndims, typndims still not enforced, but make the value within a sane threshold |