lkml.org 
[lkml]   [2020]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH 12/20] maccess: remove strncpy_from_unsafe
    On Tue, May 19, 2020 at 9:41 AM Christoph Hellwig <hch@lst.de> wrote:
    >
    > I had a lot of folks complaining about things like:
    >
    > #ifdef CONFIG_FOO
    > if (foo)
    > do_stuff();
    > else
    > #endif
    > do_something_else();
    >
    > which I personally don't mind at all, so I switched to this style.

    Well, I don't particularly like that style either, it is _very_ easy
    to get wrong when you edit it later (and various indentation checkers
    tend to be very unhappy about it too).

    But that's why I like trying to just make simple helper functions instead.

    Yeah, it's often a few more lines of code (if only because of the
    extra function definition etc), but with good naming and sane
    arguments those few extra lines can also help make it much more
    understandable in the process, and it gives you a nice place to add
    commentary for the really odd cases (comments inside code that then
    does other things often make things just harder to see).

    Linus

    \
     
     \ /
      Last update: 2020-05-19 18:46    [W:2.482 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site