Source-Changes-D archive

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

Re: CVS commit: src/sys/fs/tmpfs



On Sat, May 14, 2011 at 2:37 AM, Mindaugas Rasiukevicius
<rmind%netbsd.org@localhost> wrote:
> Matt Thomas <matt%3am-software.com@localhost> wrote:
>>
>> On May 7, 2011, at 5:03 PM, Christos Zoulas wrote:
>>
>> > Module Name:        src
>> > Committed By:       christos
>> > Date:               Sun May  8 00:03:35 UTC 2011
>> >
>> > Modified Files:
>> >     src/sys/fs/tmpfs: tmpfs_vnops.c
>> >
>> > Log Message:
>> > no c99 please.
>>
>> The kernel explicitly allows C99 and actually C99 is encouraged.
>> So that should reverted :)
>
> Generally - C99 is encouraged.  However, I disagree that variables
> should be declared in the middle of context (for a minimum scope),
> unless there is a *clear* benefit.  Otherwise, it makes code harder
> to read, especially if code fragment is long and/or complex.

I disagree.  If variables are declared in the middle of context, those
variables have narrower contexts.  Narrowing context is always a win
IMO.

I'd like to hear the benefit not doing this (== the old convention).

>
> Benefits could be, e.g. use of const or limitation of the variable
> scope for performance sensitive code, also avoiding of #ifdefs, etc.
>
> In this case, I used for (int i = 0; ...) because the loop was in
> the beginning of context and #ifdef DEBUG-only.
>
> --
> Mindaugas
>


Home | Main Index | Thread Index | Old Index