[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHk-=wgWiU_KjueEE1Mi7rk6NCKaQRE=5hQaQC+2MY6-CabKFA@mail.gmail.com>
Date: Thu, 25 Aug 2022 09:43:11 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Joseph Myers <joseph@...esourcery.com>
Cc: Florian Weimer <fweimer@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alejandro Colomar <alx.manpages@...il.com>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Alex Colomar <alx@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
linux-man <linux-man@...r.kernel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Zack Weinberg <zackw@...ix.com>,
LKML <linux-kernel@...r.kernel.org>,
glibc <libc-alpha@...rceware.org>, GCC <gcc-patches@....gnu.org>,
bpf <bpf@...r.kernel.org>, LTP List <ltp@...ts.linux.it>,
Linux API <linux-api@...r.kernel.org>,
linux-arch <linux-arch@...r.kernel.org>,
David Laight <David.Laight@...lab.com>,
Cyril Hrubis <chrubis@...e.cz>,
David Howells <dhowells@...hat.com>,
Arnd Bergmann <arnd@...db.de>, Rich Felker <dalias@...c.org>,
Adhemerval Zanella <adhemerval.zanella@...aro.org>,
Michael Kerrisk <mtk.manpages@...il.com>
Subject: Re: [PATCH v3] Many pages: Document fixed-width types with ISO C naming
On Thu, Aug 25, 2022 at 7:38 AM Joseph Myers <joseph@...esourcery.com> wrote:
>
> I've not yet implemented it for glibc or for GCC format checking, but C23
> adds 'wN' format length modifiers so you will be able to e.g. use "%w64d"
> with printf to print an int64_t and won't need those PRI macros any more.
Yeah, that's going to help user space.
We don't typically have huge issues with it (any more) in the kernel
exactly because we refused to do the syntactically horrendous PRIxyz
thing.
So in the kernel, we still do have some format string issues, but they
tend to be about "different architectures and configurations do
different things for this type", and those different things are sadly
not necessarily about a fixed width.
IOW, we used to have horrors like "sector_t can be 32-bit or 64-bit
depending on config options" (because small machines didn't want the
overhead of having to pass 64-bit things around - from back when
32-bit was a primary target).
We got rid of *that* thing a few years ago because it just wasn't
worth supporting any more, but some similar issues remain.
So we still have a number of cases of "if you really need to print
this out, you need to use '%llui' and cast the value to 'unsigned long
long'".
But it's happily not as common as it used to be.
Linus
Powered by blists - more mailing lists