← Back to team overview

elementary-dev-community team mailing list archive

Re: Coding Style parentheses exception

 

I agree that we should have consistency but at this level just seems
unproductive and a wast of time...

I think the things that really make a difference in this situations are
in cases like:

if(condition){
}

vs

if(condition)
{

}

or in functions:

return_type
func_name(param, param) {
}

vs 

return_type func_name(param, param {
}

vs

return_type func_name(param, param)
{

}

or cases like

if(cond) {
}else if {

}

vs

if(cond){
} else {
	if(cond){
	}
}


now getting to the _single_ space level just seems rather picky. 
Also it's not like all current projects managed to correctly apply
the CGL ...

There are things far more important that have not seen being address.
Such as warnings and unreachable code. But apparently they don't seem to
be a problem since they are IN the submitted code. :/



On Thu, 2012-09-13 at 11:07 -0500, Dane Henson wrote:
> 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
>         

-- 
Darcy Brás da Silva <dardevelin@xxxxxxxxxxxxxx>

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups

References