From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754495AbbEUFsn (ORCPT ); Thu, 21 May 2015 01:48:43 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:43386 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751805AbbEUFsh (ORCPT ); Thu, 21 May 2015 01:48:37 -0400 Date: Thu, 21 May 2015 07:48:06 +0200 From: Willy Tarreau To: Joe Perches Cc: Jean Delvare , Andrew Morton , Sudip Mukherjee , Wolfram Sang , Tim Waugh , Willy Tarreau , Greg Kroah-Hartman , Alan Cox , linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, devel@driverdev.osuosl.org Subject: Re: [RFC PATCH] checkpatch: check for 2 or more spaces around assignment of a declaration Message-ID: <20150521054806.GB8344@1wt.eu> References: <1432135622-8288-1-git-send-email-sudipm.mukherjee@gmail.com> <1432135622-8288-5-git-send-email-sudipm.mukherjee@gmail.com> <20150520154907.GB2001@katana> <20150520171452.GA9069@sudip-PC> <20150520195918.1c150979@endymion.delvare> <1432170126.20840.22.camel@perches.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432170126.20840.22.camel@perches.com> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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