From owner-svn-src-head@FreeBSD.ORG Sun Mar 22 18:20:57 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 B1A4A1065677 for ; Sun, 22 Mar 2009 18:20:57 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outG.internet-mail-service.net (outg.internet-mail-service.net [216.240.47.230]) by mx1.freebsd.org (Postfix) with ESMTP id 904D28FC20 for ; Sun, 22 Mar 2009 18:20:57 +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 4D4A712C17; Sun, 22 Mar 2009 11:20:57 -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 A8C532D600D; Sun, 22 Mar 2009 11:20:54 -0700 (PDT) Message-ID: <49C68197.1060204@elischer.org> Date: Sun, 22 Mar 2009 11:21:11 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: "M. Warner Losh" References: <49C5737F.1050902@gmx.de> <20090321.175756.-434257642.imp@bsdimp.com> <49C5F88C.3070600@freebsd.org> <20090322.070349.195750067.imp@bsdimp.com> In-Reply-To: <20090322.070349.195750067.imp@bsdimp.com> 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, christoph.mallon@gmx.de 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, 22 Mar 2009 18:20:58 -0000 M. Warner Losh wrote: > In message: <49C5F88C.3070600@freebsd.org> > Andriy Gapon writes: > : on 22/03/2009 01:57 M. Warner Losh said the following: > : > I'll point out that style(9) doesn't say use as few local variables as > : > possible... That part is completely unspecified. > : > : But it does say: > : Do not put declarations inside blocks unless the routine is unusually > : complicated. > > Yea, so? Just put them at the top of the function where they belong > and don't worry about it. Christoph has a long reason why this isn't bad. > > : "unusually complicated" is, of course, a very subjective measure. > : But still this guideline contradicts typical guidelines for C and its > : offspring which name we do not say to declare variables as close to > : their first usage as possible. > > thousands of lines is unusually complicated. > > : 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 original point is valid: the code changes obfuscated perfectly > readable code for no gain in the object code. > > Warner