lkml.org 
[lkml]   [2008]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Merging of completely unreviewed drivers
    Linus Torvalds wrote:
    > On Sat, 23 Feb 2008, David Newall wrote:
    >
    >> Do you actually get 80 columns wide on it?
    >>
    >
    > Do people really care that deeply?
    > ...
    > And do I find lines longer than 80 charactes unreadable? Hell no.
    >

    I care, yes. I've found my code looks much prettier, with attendant
    improvement in ease of understanding, since I stopped being so anal
    about 80 columns. The width of the code, that is first to last
    non-blank on each line, is about the same, not because I work to keep
    it narrow, but because most statements just are narrow. Sometimes I do
    get really wide statements, for example when using deep data structures,
    especially as parameters in procedure calls, and this is easier to read
    than having to break the line.

    I honestly think the reason we used to insist on lines less than 80
    characters was because on an 80 character screen, you get slightly
    better readability by choosing where to break each line than simply
    letting the hardware do it. We don't have the physical limit any more,
    so we don't need to impose it structurally.

    It's about readability, and with due respect, people who've never tried
    it aren't qualified to comment.

    > which talks more about what matters - too deep indentation.
    What's too deep? Is the following too deep? It's common enough, other
    than my refusal to relax consistent indenting style for switch bodies.
    The code is readable, and breaking it into multiple procedures just to
    de-indent is often impossible, and rarely readable. With a strict 80
    character limit, the meat in the sandwich is left with only 20 or so
    characters in which to fit. Add a nested switch, and there's virtually
    no space left for code.

    123456789012345678901234567890123456789012345678901234567890123456 (70)
    int procedure(param list)
    {
    switch (condition)
    {
    case value:
    if (another_condition)
    {
    if (variant)
    meat_in_sandwich;
    } else {
    code;
    }
    case value2:
    switch (sub_condition)
    {
    case sub_value:
    if (final_test)
    {
    something(
    NULL,
    1,
    "two");
    }
    }
    }
    }


    (Yes, I know, "we don't indent 'case' because it consumes too much
    room." That's inconsistent with the rest of normal indenting style, and
    a poor excuse to keep within an obsolete and unnecessary restriction.)


    \
     
     \ /
      Last update: 2008-02-24 05:37    [W:4.359 / U:0.320 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site