Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Mar 2009 22:13:38 -0700
From:      Julian Elischer <julian@elischer.org>
To:        Christoph Mallon <christoph.mallon@gmx.de>
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" <imp@bsdimp.com>
Subject:   Re: svn commit: r190098 - in head/sys/sparc64: fhc sparc64
Message-ID:  <49CF0382.7090102@elischer.org>
In-Reply-To: <49CE77CE.3040801@gmx.de>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
Christoph Mallon wrote:
> Julian Elischer schrieb:
>> M. Warner Losh wrote:
>>> In message: <49C5F88C.3070600@freebsd.org>
>>>             Andriy Gapon <avg@freebsd.org> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49CF0382.7090102>