From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17193 invoked by alias); 15 Dec 2010 04:54:54 -0000 Received: (qmail 17182 invoked by uid 22791); 15 Dec 2010 04:54:53 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Dec 2010 04:54:38 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 418B92BAC0D; Tue, 14 Dec 2010 23:54:36 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id qykV4oRqgW7k; Tue, 14 Dec 2010 23:54:36 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id C16572BAC1B; Tue, 14 Dec 2010 23:54:35 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 4ED36145B58; Wed, 15 Dec 2010 05:54:07 +0100 (CET) Date: Wed, 15 Dec 2010 04:54:00 -0000 From: Joel Brobecker To: Mike Frysinger Cc: gdb-patches@sourceware.org, Stephen.Kilbane@analog.com, Stuart.Henderson@analog.com, David.Gibson@analog.com Subject: Re: [PATCH] sim: add --map-info option Message-ID: <20101215045407.GW2596@adacore.com> References: <1291219863-18458-1-git-send-email-vapier@gentoo.org> <20101214073558.GS2596@adacore.com> <201012141016.23030.vapier@gentoo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201012141016.23030.vapier@gentoo.org> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00276.txt.bz2 > > Wouldn't it make sense to hoist the assignment to memory out of > > the for initial assignment? It's never changed during the loop... > > i dont understand ... isnt this the whole purpose of the first clause > of the for statement ? initializing things once that dont change > inside of the loop. The code works, and I'm fine if you really want to keep it that way. But you said "initializing things once that dont change inside of the loop" and that is not true. You would typically initialize the variables used in the looping condition, and these variables change at each iteration. But that's beside the point, and I don't think there is anything in the C language that says what should should do, or should not do. All I am saying is that you are doing something unusual: You are initializing in that clause a variable that is never changed during the loop, nor referenced in the other two clauses of your for statement. If I was maintaining the code, I would find it much clearer to initialize the variable before the loop, and then write a typical "for (...)" statement. -- Joel