[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063cb6d370f94088d5e2a385acf14d96f06e6686@intel.com>
Date: Tue, 25 Nov 2025 15:09:52 +0200
From: Jani Nikula <jani.nikula@...el.com>
To: James Bottomley <James.Bottomley@...senPartnership.com>,
ksummit@...ts.linux.dev, Dan Williams <dan.j.williams@...el.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>, Dan Carpenter
<dan.carpenter@...aro.org>
Subject: Re: Clarifying confusion of our variable placement rules caused by
cleanup.h
On Tue, 18 Nov 2025, James Bottomley <James.Bottomley@...senPartnership.com> wrote:
> For myself I do find some value in the C89 declarations at the
> beginning of the block for readability, so I'm happy to relax the
> mixing rule to cases where it's strictly necessary and require
> documenting in the comment what the necessity is.
I think I've seen an increase in patches using non-pointer const local
variables. No metrics, just a gut feeling.
const int foo = bar + 5;
I haven't really decided whether I like that or not, and subsequently I
have neither encouraged or discouraged that usage. I don't think we have
any style guidance on that either.
Anyway, more const usage like that would also benefit from declaration
and initialization at a later point when the initializer value is
available, if it's not at the beginning.
BR,
Jani.
--
Jani Nikula, Intel
Powered by blists - more mailing lists