Re: [PATCH v2 8/9] bfs: remove multiple assignments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux