svn commit: r190098 - in head/sys/sparc64: fhc sparc64

Christoph Mallon christoph.mallon at gmx.de
Sun Mar 22 01:54:39 PDT 2009


Andriy Gapon schrieb:
> on 22/03/2009 01:57 M. Warner Losh said the following:
>> I'll point out that style(9) doesn't say use as few local variables as
>> possible...  That part is completely unspecified.
> 
> But it does say:
> Do not put declarations inside blocks unless the routine is unusually
> complicated.
> 
> "unusually complicated" is, of course, a very subjective measure.
> But still this guideline contradicts typical guidelines for C and its
> offspring which name we do not say to declare variables as close to
> their first usage as possible.
> 
> E.g. you can have a simple 3 line block where you need a local variable
> but that block is located 50 lines from start of an enclosing function.
> Very convenient when you need to quickly glance the variable's type (not).

ACK

> So add me to the count of people who has problem with this rule.

I'm glad that I'm not the only one who thinks this rule hinders 
comprehensibility.

> P.S.
> And 80 symbol line rule (which is not even in style) is also not
> justified in modern times, if you'll ask me :)

I'm ok with 80 columns. But at the same time having tab stops every 8 
spaces - I consider this silly. I prefer 2, I'm ok with 4, but 8 with a 
maximum of 80 columns is somehow contradictory. I've seen quite some 
places in the source code which are very hard to read because they are 
indented several levels (two loops plus three if ()s, which can easily 
happen in a non-trivial algorithm, and you start at column 48 of 80) and 
then have to try very hard to fit into 80 columns - a newline after 
every token in one statement does not exactly improve readability.
But this is a can of worms I do not want to open now.

	Christoph


More information about the svn-src-all mailing list