Messages in this thread | | | Subject | Re: Use of void pointer arithmetic? | From | Johannes Berg <> | Date | Thu, 24 Feb 2022 11:31:12 +0100 |
| |
On Thu, 2022-02-24 at 11:59 +0200, Kalle Valo wrote: > > A good question. I have always just thought we should avoid void pointer > arithmetic due to the C standard, but now that you mention it void > pointers can indeed simplify the code. So I'm not so sure anymore. > > Any opinions? Is there a kernel wide recommendation for this?
The kernel only enables it with W=3, which I guess nobody uses anyway ... Originally it came from commit 4a5838ad9d2d ("kbuild: Add extra gcc checks") with a pointer to
http://marc.info/?l=kernel-janitors&m=129802065918147&w=2
(which is offline right now due to an expired certificate ...)
but setting back my clock it seems to point to
https://lore.kernel.org/all/20110218091716.GA4384@bicker/
but the thread kind of revolves around -Wconversion.
FreeBSD does enable -Wpointer-arith which is why we've been trying to keep iwlwifi clean as a courtesy to them, but for really Linux-only code I dunno if there's much point. Although of course that applies also to FreeBSD ...
johannes
| |