From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrian Bunk Subject: Re: [PATCH v2 8/9] bfs: remove multiple assignments Date: Sun, 27 Jan 2008 16:08:14 +0200 Message-ID: <20080127140814.GA1916@does.not.exist> References: <1201296027-6900-1-git-send-email-dmitri.vorobiev@gmail.com> <1201296027-6900-9-git-send-email-dmitri.vorobiev@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Dmitri Vorobiev , linux-fsdevel@vger.kernel.org To: Tigran Aivazian Return-path: Received: from smtp4.pp.htv.fi ([213.243.153.38]:47445 "EHLO smtp4.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753968AbYA0OHx (ORCPT ); Sun, 27 Jan 2008 09:07:53 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sat, Jan 26, 2008 at 06:35:41PM +0000, Tigran Aivazian wrote: > On Sat, 26 Jan 2008, Dmitri Vorobiev wrote: >> - inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; >> + inode->i_mtime = CURRENT_TIME_SEC; >> + inode->i_atime = CURRENT_TIME_SEC; >> + inode->i_ctime = CURRENT_TIME_SEC; > > multiple assignments like "x = y = z = value;" can potentially (depending > on the compiler and arch) be faster than "x = value; y = value; z=value;" Only depending on the compiler, and recent gcc versions are quite good at optimizing code. > I am surprized that this script complains about them as it is a perfectly > valid thing to do in C. Checkpatch warns about the something already documented in Documentation/CodingStyle: <-- snip --> Don't put multiple assignments on a single line either. Kernel coding style is super simple. Avoid tricky expressions. <-- snip --> Nobody claims it wasn't perfectly valid C code, the point is that multiple assignments on a single line are harder to read. > But this is not a "big deal", so I don't mind. > > Kind regards > Tigran cu Adrian -- "Is there not promise of rain?" Ling Tan asked suddenly out of the darkness. There had been need of rain for many days. "Only a promise," Lao Er said. Pearl S. Buck - Dragon Seed