Re: [PATCH v4 2/2] treewide: Use struct_offset()
From: David Laight
Date: Thu Nov 19 2026 - 05:19:33 EST
On Wed, 18 Nov 2026 15:05:13 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
(far too many recipients....)
> On Wed, Nov 18, 2026 at 12:50:09PM +0100, Bence Csokas wrote:
> > Generated with a simple Coccinelle patch found in
> > scripts/coccinelle/api/struct_offsetof.cocci
>
> I think this is a good example of why we don't need this. It adds yet
> another macro to remember, and doesn't actually save many characters at
> all.
>
A more interesting exercise would be adding a typeof() into offsetof() itself.
That would let you do offsetof(variable, field) as well as offsetof(type, field).
The same is true for offsetofend().
But the churn of changing all the current uses is silly.
David