tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wedges on vnd(4) patch



On Mon, Jun 21, 2010 at 05:11:26PM -0500, Eric Haszlakiewicz wrote:
> > 
> > - declare the variables on top to avoid braces in case statements.
> 
> Is this really a bad thing?  I find it makes things more readable.
> (although I tend to line things up a bit differently in my code, keeping the
>  code in each case at the same indentation level)

Readability depends on the reader :-)
Apart from variables that are local to very short (3 or 4 line) blocks,
I much prefer to have the declarations at the top of the function
because that makes them much easier to find.
Declaring variables in the middle of blocks (as you tend to be forced
to in C++) makes the declaration particularly hard to locate,
especially when the declaration shadows another local.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index