From owner-svn-src-head@FreeBSD.ORG Sun Mar 29 05:13:18 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC6BC1065673 for ; Sun, 29 Mar 2009 05:13:18 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outD.internet-mail-service.net (outd.internet-mail-service.net [216.240.47.227]) by mx1.freebsd.org (Postfix) with ESMTP id A8F8A8FC1B for ; Sun, 29 Mar 2009 05:13:18 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id B84B83BDFD; Sat, 28 Mar 2009 22:13:18 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 4F8EE2D6053; Sat, 28 Mar 2009 22:13:15 -0700 (PDT) Message-ID: <49CF0382.7090102@elischer.org> Date: Sat, 28 Mar 2009 22:13:38 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Christoph Mallon References: <49C5737F.1050902@gmx.de> <20090321.175756.-434257642.imp@bsdimp.com> <49C5F88C.3070600@freebsd.org> <20090322.070349.195750067.imp@bsdimp.com> <49C68197.1060204@elischer.org> <49CE77CE.3040801@gmx.de> In-Reply-To: <49CE77CE.3040801@gmx.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, avg@FreeBSD.org, marius@alchemy.franken.de, svn-src-head@FreeBSD.org, "M. Warner Losh" Subject: Re: svn commit: r190098 - in head/sys/sparc64: fhc sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Mar 2009 05:13:19 -0000 Christoph Mallon wrote: > Julian Elischer schrieb: >> M. Warner Losh wrote: >>> In message: <49C5F88C.3070600@freebsd.org> >>> Andriy Gapon writes: >>> : E.g. you can have a simple 3 line block where you need a local >>> variable >>> : but that block is located 50 lines from start of an enclosing >>> function. >>> : Very convenient when you need to quickly glance the variable's type >>> (not). >>> >>> No you don't. There's absolutely nothing wrong with putting them at >>> the top. In fact, it is simpler, really, than having to go hunting >>> for dozens of different declarations. As someone who has spent a lot >>> of time looking at code, the time wasted looking for these damn-fool >>> things really adds up. >> >> and in a complicated function, if you have them all over the place you >> have no idea as to what the potential stack usage of the function is.. >> This matters in the kernel. > > The declared local variables are neither a lower *nor* an upper bound > for stack usage. no but it can give you an idea as to what is going on.. most modern compilers can reuse space for non overlapping variable scope but it's still useful.. I was not saying it needs to be that way, just that there are often arguments for doing thing sone way or another that can be non-obvious.