← Back to team overview

elementary-dev-community team mailing list archive

Re: Coding Style parentheses exception

 

I agree that the space should only be on the first opening parentheses, but
not before the second. It looks cleaner to me.
On Sep 13, 2012 8:32 AM, "David Gomes" <david@xxxxxxxxxxxxxxxx> wrote:

> Hey there guys, attached is the elementary OS coding style (We have this
> on a Google Doc, but the formatting is broken on it, so I'm rewriting it
> with Writer to then port to Google Docs again).
>
> I want to add an exception regarding the space character before opening
> parentheses, and I want to know if you all agree:
>
>   Usually, we put a space character before opening parentheses:
>
>      public string get_text () {}
>
>      if (a == 5) return 4;
>
>      for (i = 0; i < maximum; i++) {}
>
>      my_function_name ();
>
>      Object my_instance = new Object ();
>
>   However, if we have something like this:
>
>          if ((e.state & Gdk.ModifierType.MOD1_MASK) != 0) {
>
>  Before the second opening parentheses on that line, I didn't put a space
> character because I think it looks quite bad. Do you guys agree that when
> we have 2 parentheses in a row we should not put a space character before
> the second one?
>
>
>          if ( (e.state & Gdk.ModifierType.MOD1_MASK) != 0) {
>
>   That's how it would look like.
>
>
> Thank youg uys.
>
> --
> Mailing list: https://launchpad.net/~elementary-dev-community
> Post to     : elementary-dev-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~elementary-dev-community
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References