Quoting Pedro Lopez-Cabanillas <pedro.lopez.cabanil...@gmail.com>:

On Monday, April 27, 2009, j...@resonance.org wrote:
I know coding style is a rather personal matter, but it would be good
to agree on it to some extent ;)

- Function return value on its own line
- Indent by 2 spaces
- Braces on new lines
- Spaces before open parenthesis '('
- Spaces between the data type and pointer '*' argument instead of the
other way around (i.e., 'void *data' not 'void* data'

I've been wanting to turn off tabs altogether with editors, since it
can be annoying when editors don't agree on how many spaces a tab is.

I imagine the most important is just to have some consistency.

Cheers.
      Josh

My preference would be:

$ indent -kr -prs -psl -i4 -nut

Translation:

- Kernighan & Ritchie style, plus:
- put a space after every '(' and before every ')'
- put the type of a procedure on the line before its name
- indentation by 4 spaces
- no tabs

Sample code:

fluid_thread_t *
new_fluid_thread( fluid_thread_func_t func, void *data, int detach )
{
    GThread *thread;
    GError *err = NULL;

    g_return_val_if_fail( func != NULL, NULL );
    thread =
        g_thread_create( ( GThreadFunc ) func, data, detach == FALSE,
                         &err );
    if ( !thread ) {
        FLUID_LOG( FLUID_ERR, "Failed to create the thread: %s",
                   fluid_gerror_message( err ) );
        g_clear_error( &err );
    }
    return thread;
}


Regards,
Pedro



Its funny how accustomed one becomes to a certain coding style. I could probably manage with that style, but to me it looks a little messy (could be just because of what I'm used to though). The space before and after parenthesis in particular looks confusing. I used to put open braces on the same line as if/for/while etc statements, but then changed to having them on a newline, which also seems more clean to me (easier to match them visually). Otherwise it looks fine (well actually, those are probably the only differences, besides the indent size ;)

Anyone else have any opinions on the matter?

Regards,
    Josh



_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to