On 11/18/2010 03:02 AM, Michael Ellerman wrote:
> On Thu, 2010-11-18 at 09:34 +0100, Ingo Molnar wrote:
>>
>> Look at the general balance of hardship: very little harm is done (it's not 
>> a big 
>> deal if a variable is only used in a single function) but having it with 
>> local 
>> variables can be _really_ harmful - for example i overlooked them when i 
>> reviewed 
>> this patch. I dont like important details obscured - i like them to be 
>> apparent. 
>> Again, this is something that some people can parse immediately on the 
>> visual level 
>> - me and many others cannot.
> 

No, sorry, this sounds like a personal preference that is well out of
line with the vast majority of C programmers I've ever come across, not
just in the Linux kernel world but outside of it.

> What about:
> 
> int foo(void)
> {
>       static int bar;
> 
>       struct thing_struct *thing;
>       int other_var;
>       char *p;
> 
>       ...
> }
> 
> I think the visual wrongness of that formatting would be enough for me
> to stop and look twice. Though I guess it doesn't work if you have few,
> or no other variables other than the statics to declare.
> 

I wouldn't object to a convention like that, but let's bloody well
realize that that is a brand new convention, and if this convention is
going to stick at all it needs to be made official and put in CodingStyle.

        -hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

_______________________________________________
devicetree-discuss mailing list
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

Reply via email to