LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: [PATCH v2 8/9] bfs: remove multiple assignments
       [not found]   ` <Pine.LNX.4.61.0801261833270.1966@ginsburg.homenet>
@ 2008-01-26 23:48     ` Dmitri Vorobiev
  2008-01-28  7:02       ` Joel Schopp
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitri Vorobiev @ 2008-01-26 23:48 UTC (permalink / raw)
  To: Tigran Aivazian
  Cc: trivial, linux-fsdevel, apw, rdunlap, jschopp, Linux-kernel

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;"
> 
> I am surprized that this script complains about them as it is a
> perfectly valid thing to do in C.

I think it seems wise to ask the maintainers of checkpatch.pl to
comment on that. I'm Cc:ing them now.

Thanks,

Dmitri


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 8/9] bfs: remove multiple assignments
  2008-01-26 23:48     ` [PATCH v2 8/9] bfs: remove multiple assignments Dmitri Vorobiev
@ 2008-01-28  7:02       ` Joel Schopp
  2008-01-30 13:06         ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Schopp @ 2008-01-28  7:02 UTC (permalink / raw)
  To: Dmitri Vorobiev
  Cc: Tigran Aivazian, trivial, linux-fsdevel, apw, rdunlap, Linux-kernel

>>> -    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;"
>>
>> I am surprized that this script complains about them as it is a
>> perfectly valid thing to do in C.
> 
> I think it seems wise to ask the maintainers of checkpatch.pl to
> comment on that. I'm Cc:ing them now.
> 

There are plenty of things that are valid to do in C that don't make for 
maintainable code.  These scripts are designed to make your code easier for 
real people to review and maintain.

As for if this can be faster we don't deal in the realm of "can".  Please 
show a concrete example of gcc making Linux kernel code faster with 
multiple assignments per line.  If you can do that I'm willing to change my 
mind and I'll lead the charge for mutliple assignments per line.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 8/9] bfs: remove multiple assignments
  2008-01-28  7:02       ` Joel Schopp
@ 2008-01-30 13:06         ` Al Viro
  2008-01-30 13:36           ` Dmitri Vorobiev
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2008-01-30 13:06 UTC (permalink / raw)
  To: Joel Schopp
  Cc: Dmitri Vorobiev, Tigran Aivazian, trivial, linux-fsdevel, apw,
	rdunlap, Linux-kernel

On Mon, Jan 28, 2008 at 01:02:03AM -0600, Joel Schopp 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;"
> >>
> >>I am surprized that this script complains about them as it is a
> >>perfectly valid thing to do in C.
> >
> >I think it seems wise to ask the maintainers of checkpatch.pl to
> >comment on that. I'm Cc:ing them now.
> >
> 
> There are plenty of things that are valid to do in C that don't make for 
> maintainable code.  These scripts are designed to make your code easier for 
> real people to review and maintain.

Except that in this case the new variant is not equivalent to the old one...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 8/9] bfs: remove multiple assignments
  2008-01-30 13:06         ` Al Viro
@ 2008-01-30 13:36           ` Dmitri Vorobiev
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitri Vorobiev @ 2008-01-30 13:36 UTC (permalink / raw)
  To: Al Viro
  Cc: Joel Schopp, Dmitri Vorobiev, Tigran Aivazian, trivial,
	linux-fsdevel, apw, rdunlap, Linux-kernel

Al Viro wrote:
> On Mon, Jan 28, 2008 at 01:02:03AM -0600, Joel Schopp 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;"
>>>>
>>>> I am surprized that this script complains about them as it is a
>>>> perfectly valid thing to do in C.
>>> I think it seems wise to ask the maintainers of checkpatch.pl to
>>> comment on that. I'm Cc:ing them now.
>>>
>> There are plenty of things that are valid to do in C that don't make for 
>> maintainable code.  These scripts are designed to make your code easier for 
>> real people to review and maintain.
> 
> Except that in this case the new variant is not equivalent to the old one...

Yes, you're right. In fact, I felt like sending yet another version
of these patches, but this gets preempted all the time by "the other things".

Dmitri

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-30 13:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1201296027-6900-1-git-send-email-dmitri.vorobiev@gmail.com>
     [not found] ` <1201296027-6900-9-git-send-email-dmitri.vorobiev@gmail.com>
     [not found]   ` <Pine.LNX.4.61.0801261833270.1966@ginsburg.homenet>
2008-01-26 23:48     ` [PATCH v2 8/9] bfs: remove multiple assignments Dmitri Vorobiev
2008-01-28  7:02       ` Joel Schopp
2008-01-30 13:06         ` Al Viro
2008-01-30 13:36           ` Dmitri Vorobiev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).