[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1xBwRCHoQtMyPf8@p183>
Date: Fri, 28 Oct 2022 23:55:29 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
catalin.marinas@....com, will@...nel.org,
rafael.j.wysocki@...el.com, masahiroy@...nel.org
Subject: Re: [PATCH] kbuild: drop -Wdeclaration-after-statement
On Fri, Oct 28, 2022 at 01:29:08PM -0700, Linus Torvalds wrote:
> On Fri, Oct 28, 2022 at 1:00 PM Alexey Dobriyan <adobriyan@...il.com> wrote:
> >
> > Putting declarations in the beginning of the block is an afterfact from
> > single pass compiler era. Compiler would parse all declarations, layout
> > stack frame and proceed to generate code.
>
> No, putting declarations at the beginning is still kernel syntax.
>
> Don't declare variables in multiple places. It gets really confusing.
It is not. Somehow millions of programmers manage to find their
variables just fine in C and other programming languages.
> Put all declarations at the top of the block they are contained in.
I tried it the other way after years of LK style. Universe didn't collapse.
> IOW, -Wdeclaration-after-statement does exactly the right thing, and stays.
>
> This is not about "old compilers", this is about coding rules.
>
> Linus
Powered by blists - more mailing lists