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

Steven Rostedt <[email protected]>
Newsgroups dev.linux.lists.ksummit,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, 25 Nov 2025 17:25:19 +0300
Alexey Dobriyan <[email protected]> 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/[email protected]/

-- Steve
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.