From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754383AbYIGGCU (ORCPT ); Sun, 7 Sep 2008 02:02:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751586AbYIGGCK (ORCPT ); Sun, 7 Sep 2008 02:02:10 -0400 Received: from 1wt.eu ([62.212.114.60]:3380 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751531AbYIGGCJ (ORCPT ); Sun, 7 Sep 2008 02:02:09 -0400 Date: Sun, 7 Sep 2008 08:01:46 +0200 From: Willy Tarreau To: Linus Torvalds Cc: Thomas Gleixner , Alok Kataria , Alan Cox , LKML , Arjan van de Veen , "H. Peter Anvin" , Peter Zijlstra , Dan Hecht , Garrett Smith Subject: Re: [RFC patch 0/4] TSC calibration improvements Message-ID: <20080907060146.GB2244@1wt.eu> References: <20080904204305.GA29065@elte.hu> <1220653095.14401.72.camel@alok-dev1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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