Messages in this thread | | | Date | Sun, 7 Sep 2008 08:01:46 +0200 | From | Willy Tarreau <> | Subject | Re: [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
| |