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

This is a discussion on Re: [PATCH v2 8/9] bfs: remove multiple assignments - 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 ...

+ Reply to Thread
Results 1 to 4 of 4

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

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

    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

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

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

    >>> - 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.


    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

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

    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...
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

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

    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
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread