From: Alexey Dobriyan <adobriyan@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
catalin.marinas@arm.com, will@kernel.org,
rafael.j.wysocki@intel.com, masahiroy@kernel.org
Subject: Re: [PATCH] kbuild: drop -Wdeclaration-after-statement
Date: Fri, 28 Oct 2022 23:55:29 +0300 [thread overview]
Message-ID: <Y1xBwRCHoQtMyPf8@p183> (raw)
In-Reply-To: <CAHk-=wiEXm3y7BrFnymC_6icE7seicGyyML+Oxd_BP9t=ztNKg@mail.gmail.com>
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@gmail.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
next prev parent reply other threads:[~2022-10-28 20:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 20:00 [PATCH] kbuild: drop -Wdeclaration-after-statement Alexey Dobriyan
2022-10-28 20:29 ` Linus Torvalds
2022-10-28 20:55 ` Alexey Dobriyan [this message]
2022-10-28 21:11 ` Linus Torvalds
2022-10-29 11:47 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y1xBwRCHoQtMyPf8@p183 \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox