Re: GTK+ policy (was RE:rendering-cleanup-next)



On Mon, 2010-09-13 at 21:48 -0400, Paul Davis wrote:
> On Mon, Sep 13, 2010 at 6:27 PM, Matthias Clasen
> <matthias clasen gmail com> wrote:
> > 2010/9/13 Thomas Wood <thos gnome org>:
> >>
> >> Clutter's (very detailed) coding style document may be useful here,
> >> since it has a very similar coding style to GTK+:
> >>
> >> http://git.clutter-project.org/clutter/tree/doc/CODING_STYLE
> >>
> >
> > Yes, I think we could basically adopt this word-by-word.
> 
> i know that coding styles are, as it says in the clutter guide,
> "arbitrary", but i would just like to mention one little detail that i
> find problematic when working on shared projects (and much less so on
> non-shared projects). this rule:
> 
> ----------------------------------
> Curly braces should not be used for single statement blocks:
> 
>   if (condition)
>     single_statement ();
>   else
>     another_single_statement (arg1);
> -----------------------------------
> 
> what's wrong with this?

There are valid arguments the other way, and you make them. But
remember, GTK+ is using GNU style bracing and that pretty much takes the
question out of the matter. Doing:

 if (conditition)
   {
     single_statement ();
   }
 else
   {
     another_single_statement ();
   }

consistently wouldn't really fly. (Plus, there's the question of all the
existing code...)

- Owen

[ Along with the nested if thing, if you are specifying exactly
  the style, the other thing to note is that if one branch of an if gets
  braces because it is multiline, the other branch should usually get
  them too ]

 




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