Re: Clarifying confusion of our variable placement rules caused by cleanup.h

From: Steven Rostedt
Date: Tue Nov 25 2025 - 11:04:36 EST


On Tue, 25 Nov 2025 17:25:19 +0300
Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:

> C89 style provokes substyles(!) which makes adding new variables even
> more obnoxious: some subsystems have(had?) a rule saying that declarations
> (with initializers) must be sorted by length, so not only programmer has
> to PageUp to the beginning of the block, but then aim carefully and
> insert new declaration.

As one of the subsystem maintainers that enforce the "order by length"
rule, I'm also for making more exceptions to the c89 method. The reason we
do the "order by length" is for aesthetic reasons, as nicer looking code is
easier to read. If there's a rule to have all declarations at the top, at
least make it pretty!

But yeah, perhaps if we didn't have a strict enforcement of declaring
everything at the top, we wouldn't have bugs like this:

https://lore.kernel.org/all/20251125032630.8746-3-piliu@xxxxxxxxxx/

-- Steve