fluid-dev
[Top][All Lists]
Advanced

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

Re: [fluid-dev] Coding style (was: More commits)


From: David Henningsson
Subject: Re: [fluid-dev] Coding style (was: More commits)
Date: Wed, 29 Apr 2009 07:05:02 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090409)

address@hidden skrev:
> Quoting David Henningsson <address@hidden>:
>> address@hidden skrev:
>>> Anyone else have any opinions on the matter?
>> Of course I have, but it seems like I will be voted down in most of the
>> cases below :-)
> I'm hoping we can find a happy medium, where the most annoying
> formatting to any one of us is not used.  One or more of us may still
> have to live with some minor annoyances though, but I doubt that will
> lead to permanent insanity ;-)

I can live with almost everything I'm not very annoyed with people using
different coding styles. But when I write code I will most certainly
make mistakes, how will we solve that? Perhaps I will have to run
"indent" or similar program before I commit?

>> I don't like to indent to
>> the amount of a procedure name,
>> because_if_you_have_a_very_long_function_name(that,
>>                                               will,
>>                                               mean,
>>                                               that,
>>                                               you,
>>                                               will,
>>                                               have,
>>                                               to,
>>                                               put,
>>                                               every,
>>                                               parameter,
>>                                               on, a,
>>                                               new line);
> In cases like that, I often cheat and just do:
> 
>   because_if_you_have_a_very_long_function_name
>     (that, will, mean, that, you, ...);
> 
> I personally like following lines to line up with the parenthesis they
> belong to, makes it easier to group the statements visually and know
> which set of parenthesis they belong to.

Another variation if you want a "visual match" could be:

   because_if_you_have_a_very_long_function_name (
      that, will, mean, that, you, ...
   );

(Although my personal preference would be:
    because_if_you_have_a_very_long_function_name(that, will, mean,
        that, you, will, have, to put, every, parameter, on, a, new
        line);
)

I think I personally scan for "name(" to easily see what is a function
call and not a variable.

>> Btw, do we have an approximately max lines per unit?
> Not sure what you mean by that.  Do you mean what is the current line
> count in FluidSynth source for the file with the most lines?

Is there a rule like "If a file is more than 2000 lines we should
consider splitting it in two"? Personally I like to keep my files 1000
lines or shorter, but for this project it doesn't matter much. And if
that means we will get many more source files, perhaps source
subdirectories could be considered.

Another thing is max columns per line. Do we keep it at 76/80 chars and
then a new line, or how long lines do we allow?

> Voting summary:
> - No tabs (Pedro, Josh and David)
> - 4 space indentation (Pedro, Josh 2 or 4, David doesn't care)
> - Return type on separate line from function (Pedro and Josh)
> - Space between type and '*' (GThread *) (Pedro and Josh)
> - Braces on same line as previous statement except procedures (Pedro
> and David)
> - Additional statements line up with '(' and '[' (Pedro and Josh)

If we want consistency, perhaps "majority of existing FluidSynth code"
should have a vote as well? Or are you planning to autoindent all the
existing code?

// David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]