RE: [PATCH] Makefile: Yes. Finally remove '-Wdeclaration-after-statement'

From: David Laight
Date: Tue Aug 18 2020 - 04:56:30 EST


> 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)