From owner-freebsd-arch@FreeBSD.ORG Tue Feb 1 07:04:46 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 330C916A4CE for ; Tue, 1 Feb 2005 07:04:46 +0000 (GMT) Received: from mail25.syd.optusnet.com.au (mail25.syd.optusnet.com.au [211.29.133.166]) by mx1.FreeBSD.org (Postfix) with ESMTP id 68E3D43D2D for ; Tue, 1 Feb 2005 07:04:45 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) j1174biK023764 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Tue, 1 Feb 2005 18:04:44 +1100 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])j1173c7l045660; Tue, 1 Feb 2005 18:03:38 +1100 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost)j1173cXd045659; Tue, 1 Feb 2005 18:03:38 +1100 (EST) (envelope-from pjeremy) Date: Tue, 1 Feb 2005 18:03:38 +1100 From: Peter Jeremy To: Ryan Sommers Message-ID: <20050201070338.GA45608@cirb503493.alcatel.com.au> References: <20050128173327.GI61409@myrddin.originative.co.uk> <20050131102630.GJ61409@myrddin.originative.co.uk> <41FE426E.1050807@gamersimpact.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41FE426E.1050807@gamersimpact.com> User-Agent: Mutt/1.4.2i cc: arch@freebsd.org 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 07:04:46 -0000 On Mon, 2005-Jan-31 08:36:30 -0600, Ryan Sommers wrote: >all it takes to force yourself to think "do I really need this?" Or you >might look at your other declarations and realize, "hey I could use this >instead." Finding a stray int (or whatever) that doesn't appear to be live at a particular point and re-using it for something unrelated isn't necessarily good coding practice either. This can confuse someone who is quickly scanning the code - especially if the variable name was mnemonic and the re-use doesn't match it's name. It's unfortunate that C doesn't have any way to define the end of a variable's scope (or lifetime) apart from blocks. -- Peter Jeremy