Re: Clarifying confusion of our variable placement rules caused by cleanup.h
Jani Nikula <[email protected]>
| Newsgroups | dev.linux.lists.ksummit,org.kernel.vger.linux-kernel |
|---|---|
| Organization | Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo |
| Message-ID | <[email protected]> |
On Tue, 18 Nov 2025, James Bottomley <[email protected]> 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