lkml.org 
[lkml]   [2008]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC patch 0/4] TSC calibration improvements
    On Sat, Sep 06, 2008 at 02:10:32PM -0700, Linus Torvalds wrote:

    > The fact is, the code that Ingo added was totally bogus. The real bug was
    > that he did a totally bogus "--expect" in the argument to that last call.

    BTW, I hate to see state-changing instructions inside an if condition.
    I've been bitten several times while debugging. You try to temporarily
    comment out the if statement for a test and you end up with different
    code. Same for printf. Examples of dangerous usages :

    i = 0;
    for (x = 0; x < 100; x++) {
    update_var(&i);
    if (debug && i--)
    printf("Hey I'm here\n");
    }
    return i;

    You can bet that the if will go away before production. Variant with
    similar effects :

    i = 0;
    for (x = 0; x < 100; x++) {
    update_var(&i);
    printf("Hey I'm here : %d\n", --i);
    }
    return i;

    Since it costs nothing (except one tab and one LF) to put the instruction
    out of the condition, I prefer to see them extracted :

    i = 0;
    for (x = 0; x < 100; x++) {
    update_var(&i);
    i--;
    if (debug)
    printf("Hey I'm here\n");
    }
    return i;
    >

    Willy



    \
     
     \ /
      Last update: 2008-09-07 08:05    [W:4.488 / U:0.112 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site