[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r9716 - trunk/subversion/libsvn_wc

From: Ben Reser <ben_at_reser.org>
Date: 2004-05-15 18:56:04 CEST

On Sat, May 15, 2004 at 12:39:53PM -0400, Greg Hudson wrote:
> On Sat, 2004-05-15 at 12:31, Ben Reser wrote:
> > Wouldn't it be (marginally) better to put the dirent_kind_storage within
> > the if block? There's not really any point in allocating the memory
> > outside the block if we're not using it. :)
>
> Please don't harp on this stuff. It isn't actually more efficient, in
> any practical sense, to put variable declarations in an inner block, and
> whether we should do so in any particular case is a style call.

Actually after looking at it some more, and talking with dionisos about
it...

Written the way it is it needs to be where it is. Because we're doing
this:

      svn_node_kind_t *dirent_kind, dirent_kind_storage;
[snip]
            dirent_kind = &dirent_kind_storage;

I really don't care for stuff like this because I find it to become
problematic in the future. In one case we have dirent_kind allocated
out of a pool. In another case it's on the stack. That has potential
to bite us in the butt if we change the code in the future.

As far as harp on this stuff. I don't see how this is any less
appropriate than people harping on spaces between parenthesis.
Especially considering that the style guidelines that we're supposedly
following says you should do so:

Section 5.3 of the GNU coding standards:
"It used to be common practice to use the same local variables (with
names like tem) over and over for different values within one function.
Instead of doing this, it is better to declare a separate local variable
for each distinct purpose, and give it a name which is meaningful. This
not only makes programs easier to understand, it also facilitates
optimization by good compilers. You can also move the declaration of
each local variable into the smallest scope that includes all its uses.
This makes the program even cleaner."

Though granted in this particular case the scope is correct, though I
think the design is wrong that created that correct scoping.

-- 
Ben Reser <ben@reser.org>
http://ben.reser.org
"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat May 15 18:56:19 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.