From owner-freebsd-arch@FreeBSD.ORG Tue Feb 1 19:04:34 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE44A16A4CE for ; Tue, 1 Feb 2005 19:04:34 +0000 (GMT) Received: from mx1.originative.co.uk (freebsd.gotadsl.co.uk [81.6.249.198]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A66643D46 for ; Tue, 1 Feb 2005 19:04:34 +0000 (GMT) (envelope-from paul@mx1.originative.co.uk) Received: from localhost (unknown [127.0.0.1]) by mx1.originative.co.uk (Postfix) with ESMTP id E9DA515575 for ; Tue, 1 Feb 2005 19:04:32 +0000 (GMT) Received: from mx1.originative.co.uk ([127.0.0.1])port 10024) with ESMTP id 97617-06 for ; Tue, 1 Feb 2005 19:04:17 +0000 (GMT) Received: by mx1.originative.co.uk (Postfix, from userid 1000) id 3971E15583; Tue, 1 Feb 2005 19:04:17 +0000 (GMT) Date: Tue, 1 Feb 2005 19:04:17 +0000 From: Paul Richards To: arch@freebsd.org Message-ID: <20050201190416.GG61409@myrddin.originative.co.uk> References: <20050128173327.GI61409@myrddin.originative.co.uk> <20050131102630.GJ61409@myrddin.originative.co.uk> <20050201180624.GB19624@funkthat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050201180624.GB19624@funkthat.com> User-Agent: Mutt/1.5.6i Subject: Re: c99/c++ localised variable definition X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2005 19:04:34 -0000 On Tue, Feb 01, 2005 at 10:06:24AM -0800, John-Mark Gurney wrote: > Paul Richards wrote this message on Mon, Jan 31, 2005 at 10:26 +0000: > > [...] > > > I think the loop usage though is one clear example where it is > > clearer. I think there are others as well; where the usage of the > > variable is clearly localised it is much easier to see a local > > definition than to have to jump back and forth to find out what > > variables are. > > I personally think it isn't. One thing that I do in python all to > regularly (because it lacks variable declarations), is attempt to do: > for i in foo: > for j in bar: > for i in baz: That would work fine with c99. > > And wonder why i gets such a strange value... It appears that unless > you have WARNS=4 set, warnings about: > t.c:10: warning: declaration of 'i' shadows a previous local > > don't show up. So, I would say we HAVE to get the tree building with > WARNS=4 and -Werror before we let this into style(9)... The issue with shadowing outer scope variables is only an issue if you need to access them. If your only using the syntax for loop variables to do the looping then there's no issue. -- Paul Richards