From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105540 invoked by alias); 3 Jan 2019 21:46:06 -0000 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 Received: (qmail 105348 invoked by uid 89); 3 Jan 2019 21:45:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=toward, familiar, lean X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.46.126) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Jan 2019 21:45:45 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 0050C1B3E0 for ; Thu, 3 Jan 2019 15:45:31 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fAnygQVv3iQerfAnygT3ow; Thu, 03 Jan 2019 15:45:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PF8Gref4u/sUf+T0j6ZdEpg94NBAv3H+xm51uDfGsW4=; b=u28LEh6ZjJOnc47b5btTJheIsJ S7J/a5fW7s+gSxqNlQl6KFDXHSmkYqI55nqaB9R/iU5UCLmI22v6i6d3GMmV0HmGcI5fxoVL4j3pH ebA0oGmFDoomA4eRGGLcpJWp3; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:41886 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gfAny-002FeG-Mx; Thu, 03 Jan 2019 15:45:30 -0600 From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 00/12] Remove some ALL_* iteration macros References: <20181125165439.13773-1-tom@tromey.com> <4406ff6a-975d-0db7-747c-27c7edda8bdb@simark.ca> Date: Thu, 03 Jan 2019 21:46:00 -0000 In-Reply-To: <4406ff6a-975d-0db7-747c-27c7edda8bdb@simark.ca> (Simon Marchi's message of "Wed, 26 Dec 2018 20:52:08 -0500") Message-ID: <87y381v2iu.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-01/txt/msg00067.txt.bz2 >>>>> "Simon" == Simon Marchi writes: Simon> I was wondering if you had thought about replacing, for example Simon> ALL_COMPUNITS (objfile, s) Simon> with an equivalent like this Simon> for (compunit_symtab *s : all_compunits (current_program_space)) Simon> in order to avoid nested loops like [...] Yeah, I don't think I really considered it. Simon> I am not sure which one I like best. The flat version reduces indentation, but Simon> the nested version makes it clear and explicit how the data is represented, so Simon> it might help readers who are less familiar with the code. Same for me. Maybe I lean a bit toward the explicit form but that might only be because I already have the patch in hand. Simon> Also, in theory, according to the coding style, we should write Simon> for (...) Simon> { Simon> for (...) Simon> { Simon> ... Simon> ... Simon> } Simon> } I thought it was ok to leave a single statement unbraced, though I personally never do this for something like: for (...) if ... else... ...since I think that's less readable than the braced version. If the braces are needed then that probably argues for a smarter iterator, to avoid excessive indentation. Tom