Coding practices proposals

Sam Hartman hartmans at MIT.EDU
Fri Mar 18 12:23:12 EDT 2011


>>>>> "Tom" == Tom Yu <tlyu at MIT.EDU> writes:

    Tom> Sam Hartman <hartmans at 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.

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

OK, I find that there are a number of situations where inner scopes make
code easier to understand.

If you want to push for smaller functions, that's fine, but it seems
like the best way to do that is to actually have recommendations about
smaller functions being good, and citing using inner scopes as one sign
that possibly you need a helper function.



More information about the krbdev mailing list