On Wed, Apr 27, 2011 at 4:36 PM, Andrew Beekhof <andrew(a)beekhof.net> wrote:
actually here are the emacs settings i've been using that
implement
the style i've been talking about :-)
(defconst pacemaker-c-style
'((c-basic-offset . 4)
(c-hanging-braces-alist . ((substatement-open after)))
(c-offsets-alist . ((topmost-intro . 0)
(topmost-intro-cont . 0)
(substatement . +)
Hmmm. I think this means that
> + - If a function name gets really long, start the arguments
on their own
> + line with 8 spaces of indentation:
should read 4 spaces. My bad.
(substatement-open . 0)
(case-label . +)
(access-label . -)
(inclass . ++)
(inline-open . 0)
(statement-case-open . +)
))
) "pacemaker")
(c-add-style "pacemaker" pacemaker-c-style t)
(c-set-style "pacemaker")
On Wed, Apr 27, 2011 at 4:33 PM, Andrew Beekhof <andrew(a)beekhof.net> wrote:
> hahaha - i see you kept the fn name :-)
>
> ack
>
> On Wed, Apr 27, 2011 at 3:21 AM, Russell Bryant
> <russell(a)russellbryant.net> wrote:
>> 1) Add note on line length.
>>
>> 2) Add guidelines about pointer formatting.
>>
>> 3) Add guidelines on function declarations.
>>
>> 4) Note that C types must also begin with "mh_".
>>
>> 5) Add a section with recommended vim settings.
>>
>> Signed-off-by: Russell Bryant <russell(a)russellbryant.net>
>> ---
>> doc/coding_guidelines.txt | 66 +++++++++++++++++++++++++++++++++++++++++++-
>> 1 files changed, 64 insertions(+), 2 deletions(-)
>>
>> diff --git a/doc/coding_guidelines.txt b/doc/coding_guidelines.txt
>> index 44bec11..6c0106e 100644
>> --- a/doc/coding_guidelines.txt
>> +++ b/doc/coding_guidelines.txt
>> @@ -12,6 +12,7 @@
>> 1) Introduction
>> 2) Formatting Guidelines
>> 3) Naming Conventions
>> + 4) vim Settings
>>
>> -------------------------------------------------------------------------------
>> -------------------------------------------------------------------------------
>> @@ -30,7 +31,52 @@ code that will be a part of the Matahari project.
>> --- 2) Formatting Guidelines
>> -------------------------------------------------------------------------------
>>
>> -a) Indentatation is 4 spaces, no tabs.
>> +a) Whitespace
>> +
>> + - Indentation must be 4 spaces, no tabs.
>> +
>> + - Do not leave trailing whitespace.
>> +
>> +b) Line Length
>> +
>> + - Lines should be no longer than 80 characters unless limiting line length
>> + significantly impacts readability.
>> +
>> +b) Pointers
>> +
>> + - The '*' goes by the variable name, not the type:
>> +
>> + char *foo;
>> +
>> + - Use a space before the '*' and after the closing parenthesis in a
cast:
>> +
>> + char *foo = (char *) bar;
>> +
>> +c) Functions
>> +
>> + - Put the return type on its own line:
>> + - Place the opening brace for a function on the next line:
>> +
>> + static int
>> + foo(void)
>> + {
>> +
>> + - For functions with enough arguments that they must break to the next
>> + line, align arguments with the first argument:
>> +
>> + static int
>> + function_name(int bar, const char *a, const char *b,
>> + const char *c, const char *d)
>> + {
>> +
>> + - If a function name gets really long, start the arguments on their own
>> + line with 8 spaces of indentation:
>> +
>> + static int
>> + really_really_long_function_name_this_is_getting_silly_now(
>> + int bar, const char *a, const char *b,
>> + const char *c, const char *d)
>> + {
>>
>> -------------------------------------------------------------------------------
>> -------------------------------------------------------------------------------
>> @@ -39,7 +85,23 @@ a) Indentatation is 4 spaces, no tabs.
>> --- 3) Naming Conventions
>> -------------------------------------------------------------------------------
>>
>> -a) Public C API calls must begin with "mh_".
>> +a) Public C API calls and type names must begin with "mh_".
>> +
>> +-------------------------------------------------------------------------------
>> +-------------------------------------------------------------------------------
>> +
>> +-------------------------------------------------------------------------------
>> +--- 4) vim Settings
>> +-------------------------------------------------------------------------------
>> +
>> +" This section contains settings that can be placed in the vimrc file that
are
>> +" compatible with the Matahari coding guidelines.
>> +
>> +" Whitespace
>> +set ts=4
>> +set sw=4
>> +set expandtab
>> +let c_space_error=1
>>
>> -------------------------------------------------------------------------------
>> -------------------------------------------------------------------------------
>> --
>> 1.7.4.4
>>
>> _______________________________________________
>> Matahari mailing list
>> Matahari(a)lists.fedorahosted.org
>>
https://fedorahosted.org/mailman/listinfo/matahari
>>
>