[16701] in Kerberos_V5_Development

home help back first fref pref prev next nref lref last post

Re: Coding practices proposals

daemon@ATHENA.MIT.EDU (Tom Yu)
Fri Mar 18 11:49:59 2011

To: Sam Hartman <hartmans@mit.edu>
From: Tom Yu <tlyu@mit.edu>
Date: Fri, 18 Mar 2011 11:49:55 -0400
In-Reply-To: <tslzkoswvl8.fsf@mit.edu> (Sam Hartman's message of "Fri,
	18 Mar 2011 06:50:59 -0400")
Message-ID: <ldvlj0c77j0.fsf@cathode-dark-space.mit.edu>
MIME-Version: 1.0
Cc: "krbdev@mit.edu" <krbdev@mit.edu>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: krbdev-bounces@mit.edu

Sam Hartman <hartmans@MIT.EDU> writes:

> Hmm.  I'd like to propose dropping the recommendation against inner
> scope variables and the requirement to clean up owner pointers in the
> top-most scope in this case.

I prefer to retain the recommendation of avoiding inner scope
variables.  Functions complicated enough to need inner scope variables
are often complicated enough that they should be split into smaller
pieces.  There are some borderline examples that I might consider to
be OK, such as local variables inside a small loop body, but they
should still be dealt with carefully.

We should try to determine if modern versions of gdb still have issues
with tracking the values of variables in inner scopes.

> I think a lot of my bias here is from c++, where I've seen a lot of
> advantages to declaration near use.
> I understand that there are significant cleanup advantages to c++ that
> don't apply here.

I forsee situations in C where developers would be strongly tempted to
have multiple cleanup labels in one function to deal with freeing
memory whose pointers are stored in inner scope variables.  I would
like to remove that temptation.
_______________________________________________
krbdev mailing list             krbdev@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev

home help back first fref pref prev next nref lref last post