[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9bae5c76-db1e-b9e3-cdfa-ab22f9d8b58c@petrovitsch.priv.at>
Date: Thu, 14 Oct 2021 01:16:04 +0200
From: Bernd Petrovitsch <bernd@...rovitsch.priv.at>
To: David Laight <David.Laight@...LAB.COM>,
"'Joe Perches'" <joe@...ches.com>,
LKML <linux-kernel@...r.kernel.org>
Cc: kernel-janitors <kernel-janitors@...r.kernel.org>
Subject: Re: Use of '%#02x' is almost always wrong
Hi all!
On 12/10/2021 23:10, David Laight wrote:
[...]
>> So presumably all the uses of %#02x in the kernel are not outputting
>> what is actually expected. Perhaps all of these should use %#04x.
>
> Doesn't help. The definition of "%#x" is completely broken.
Seconded ...
> Basically 0 doesn't get the "0x" prefix, so "%#04x" outputs
... just because of that.
And if one get's in touch with tools where format strings are
the % -stuff is not consistently used ...
> "0000" if the value is zero.
> So the correct replacement is (probably) "0x%02x".
At least it's consistent that way.
And in the big techie picture, I don't see what the '#' modifer
buys and why it makes sense to use it.
Kind regards,
Bernd
--
Bernd Petrovitsch Email : bernd@...rovitsch.priv.at
There is NO CLOUD, just other people's computers. - FSFE
LUGA : http://www.luga.at
Powered by blists - more mailing lists