[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190914015858.7c76e036@lwn.net>
Date: Sat, 14 Sep 2019 01:58:58 -0600
From: Jonathan Corbet <corbet@....net>
To: Joe Perches <joe@...ches.com>
Cc: linux-doc@...r.kernel.org,
linux-kernel <linux-kernel@...r.kernel.org>,
Louis Taylor <louis@...gniz.eu>
Subject: Re: [PATCH] docs: printk-formats: Stop encouraging use of
unnecessary %h[xudi] and %hh[xudi]
On Fri, 06 Sep 2019 14:11:51 -0700
Joe Perches <joe@...ches.com> wrote:
> Standard integer promotion is already done and %hx and %hhx is useless
> so do not encourage the use of %hh[xudi] or %h[xudi].
>
> As Linus said in:
> Link: https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/
>
> It's a pointless warning, making for more complex code, and
> making people remember esoteric printf format details that have no
> reason for existing.
>
> The "h" and "hh" things should never be used. The only reason for them
> being used if if you have an "int", but you want to print it out as a
> "char" (and honestly, that is a really bad reason, you'd be better off
> just using a proper cast to make the code more obvious).
>
> So if what you have a "char" (or unsigned char) you should always just
> print it out as an "int", knowing that the compiler already did the
> proper type conversion.
>
> Signed-off-by: Joe Perches <joe@...ches.com>
Applied, thanks.
I took the liberty of removing "Link:" (but not the URL) from the commit
message. That wasn't a patch tag, there is no real reason to make it
look like one...
jon
Powered by blists - more mailing lists