c99/c++ localised variable definition
Paul Richards
paul at originative.co.uk
Mon Jan 31 08:54:49 PST 2005
On Mon, Jan 31, 2005 at 11:41:57AM -0500, David Schultz wrote:
> On Mon, Jan 31, 2005, Paul Richards wrote:
> > Ok, to sum up the discussion then:
> >
> > 1) In the kernel the issue of stack usage is a relevant consideration
> > against adopting the new style.
>
> Is it? In my experience, gcc 3.X does a proper liveness analysis
> at -O1 and higher, and reuses stack space pretty well. This is an
> elementary optimization. (Some people don't seem to trust the
> compiler to do this, so they do evil things such as reuse an
> identifier to mean two different things in the same function.)
It's more a question of the programmer being able to do a quick
visual check i.e. it's easy to spot bad practice say creating a
large array on the stack, if it's all there in one place. If it's
spread throughout the file then you might not spot that erroneous
line.
I think tools would be better used here than code style but I can
see the point of the argument.
--
Paul Richards
More information about the freebsd-arch
mailing list