Re: Nautilus coding style change



On 30Apr2003 12:31PM (-0400), Alexander Larsson wrote:
> Dave and I have decided to finally remove the "all local variable 
> declarations have to go at the top of the function" rule from the Nautilus 
> coding-style guide. Both of us dislike this rule, and removing it doesn't 
> really cause any inconsistancies in the formating style of the codebase.
> 
> I'm truely sorry for every patch submitter I've pestered about this 
> previously, but rest assured that your future patches may scope variables 
> however you want. 
> 
> In other words: ROCK ON!

For what it's worth, the original reason for this rule was due to lack
of C++-like ability to put a declaration anywhere, only in a
block. This made things hard to refactor if you had a declaration at
the start of an if block that got rearranged to not be conditional any
more. Also, the practice of making a gratuitous block just to declare
some morevariables was considered too ugly to use.

However, with C99, the entire reason for the rule is obsolete. It
should now be possible to put declarations anywehre, so putting them
at the start of an if or while block should impose no special problems
for others changing the code in the future.

Regards,

Maciej




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]