[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150521054806.GB8344@1wt.eu>
Date: Thu, 21 May 2015 07:48:06 +0200
From: Willy Tarreau <w@....eu>
To: Joe Perches <joe@...ches.com>
Cc: Jean Delvare <jdelvare@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Sudip Mukherjee <sudipm.mukherjee@...il.com>,
Wolfram Sang <wsa@...-dreams.de>, Tim Waugh <tim@...erelk.net>,
Willy Tarreau <willy@...a-x.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alan Cox <gnomes@...rguk.ukuu.org.uk>,
linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org,
devel@...verdev.osuosl.org
Subject: Re: [RFC PATCH] checkpatch: check for 2 or more spaces around assignment of a declaration
On Wed, May 20, 2015 at 06:02:06PM -0700, Joe Perches wrote:
> Perhaps space aligned declarations should have some
> checkpatch --strict warning for 2 or more spaces
> around any assignment of the declaration.
>
> int a = 1; // 2+ spaces before =
> int b = 2; // 2+ spaces after =
> int c = 3; // uses tabs around =, no warning
> int d = 4; // uses 2 tabs before =, no warning
FWIW, in my own code I've stopped using tabs for this and replaced
them with spaces. Tabs are fine *before* code but they completely
mangle the display for people using different tab sizes, or even
when reading diffs, because they heavily depend on the number of
characters *before* them while what you want is to ensure that
what is *after* is on a fixed position.
I would even go further and report warnings when tabs are used after
text.
Tabs after text were very useful in ASM editors in the past because
it was possible to define 3 fixed positions (mnemonic, operands,
comments) and that was the primary purpose of tabs. But in todays
editors, tabs do not mean "jump to next position" but "add between
1 and 8 to the current position" which doesn't make sense at all
if what preceeds can be larger than 8 (which is most often the case
in C code).
Willy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists