[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [fluid-dev] More commits
From: |
David Henningsson |
Subject: |
Re: [fluid-dev] More commits |
Date: |
Tue, 28 Apr 2009 08:40:43 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090409) |
address@hidden skrev:
> 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?
Of course I have, but it seems like I will be voted down in most of the
cases below :-)
- Spaces per identation level: don't care much about the exact amount,
and skipping tabs altogether is a good idea. 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);
- Prefer having opening braces on same line (except for function bodies).
- Extra spaces before and after parentheses, don't like it.
- Extra row just for the function return type, don't like it.
I guess my motivation for "compacting" the code the less lines you use,
and the more code you can read without scrolling, which gives a better
overview.
Btw, do we have an approximately max lines per unit?
So here's my sample (go ahead and puke if you don't like it ;-) )
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;
}
// David
- [fluid-dev] More commits, josh, 2009/04/27
- Re: [fluid-dev] More commits, Pedro Lopez-Cabanillas, 2009/04/27
- Re: [fluid-dev] More commits, josh, 2009/04/27
- Re: [fluid-dev] More commits,
David Henningsson <=
- Re: [fluid-dev] More commits, josh, 2009/04/28
- Re: [fluid-dev] Coding style (was: More commits), David Henningsson, 2009/04/29
- Re: [fluid-dev] Coding style (was: More commits), josh, 2009/04/29
- Re: [fluid-dev] Coding style, David Henningsson, 2009/04/29
- Re: [fluid-dev] Coding style, josh, 2009/04/29