From: Dan Carpenter <dan.carpenter@oracle.com>
To: Steve French <smfrench@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors <kernel-janitors@vger.kernel.org>,
Yu Zhe <yuzhe@nfschina.com>
Subject: Re: Is casting a void ptr to something else considered bad kernel coding style
Date: Fri, 15 Jul 2022 11:15:20 +0300 [thread overview]
Message-ID: <20220715081520.GX2338@kadam> (raw)
In-Reply-To: <CAH2r5msuc3-1V+dh5NdwnE6uBoN+7_cf=m6kwrFrTnwArND0LQ@mail.gmail.com>
On Thu, Jul 14, 2022 at 05:00:19PM -0500, Steve French wrote:
> For examples like this where a pointer which is (void *) is cast to
> something else, is this considered bad coding style in kernel C
> programming?
>
> It may be that leaving the (unnecessary) cast in, although it is not
> required for C, makes the code clearer in some cases.
>
> Any opinions on changes to remove casts of void pointers for kernel
> code (which I have recently seen suggested)?
>
Pointless casts are bad, but the churn is bad too...
regards,
dan carpenter
prev parent reply other threads:[~2022-07-15 8:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 22:00 Is casting a void ptr to something else considered bad kernel coding style Steve French
2022-07-15 5:20 ` Julia Lawall
2022-07-15 8:15 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220715081520.GX2338@kadam \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=smfrench@gmail.com \
--cc=yuzhe@nfschina.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox