[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e986450210154d49aee1a3885d76c862@AcuMS.aculab.com>
Date: Tue, 18 Aug 2020 08:56:22 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Ingo Molnar' <mingo@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
CC: Pavel Machek <pavel@....cz>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Al Viro <viro@...iv.linux.org.uk>,
Michael Witten <mfwitten@...il.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Cong Wang <xiyou.wangcong@...il.com>,
"Johannes Weiner" <hannes@...xchg.org>,
Sam Ravnborg <sam@...nborg.org>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
John Levon <john.levon@...ent.com>,
"John Levon" <levon@...ementarian.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: RE: [PATCH] Makefile: Yes. Finally remove
'-Wdeclaration-after-statement'
> I'm a big fan of -Wdeclaration-after-statement and I think C++ style
> mixed variables/statements code has several disadvantages:
Agreed.
Personally I think declarations should either be either right
at the top of a function or in a very small code block.
Otherwise they are annoying to find.
You also get very hard to spot bugs unless -Wshadow
is enabled (I can't remember if the linux kernel has
it enabled).
C++ (sort of) has to allow definitions in the middle
of code blocks because it doesn't allow uninitialised
variables - so definitions are best delayed until the
copy-constructor can be used.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists