Re: Coding style: brace initialization syntax

2018-06-06 Thread bpostelnicu
On Wednesday, June 6, 2018 at 5:21:05 AM UTC+3, gsqu...@mozilla.com wrote: > On Wednesday, June 6, 2018 at 5:35:59 AM UTC+10, Boris Zbarsky wrote: > > On 6/5/18 3:10 PM, Emilio Cobos Álvarez wrote: > > > I personally would prefer one space at each side when using braces: > > > > > >  , mFoo { 0 }

Re: Coding style: brace initialization syntax

2018-06-06 Thread Karl Tomlinson
On Fri, 13 Apr 2018 10:22:06 -0400, Boris Zbarsky wrote: > On 4/13/18 9:37 AM, Emilio Cobos Álvarez wrote: >> Would people agree to use: >> >>  , mIsRootDefined { false } >> >> Instead of: >> >>  , mIsRootDefined{ false } > > So my take is that we should not use braced initializer syntax in > co

Re: Coding style: brace initialization syntax

2018-06-05 Thread gsquelart
On Wednesday, June 6, 2018 at 5:35:59 AM UTC+10, Boris Zbarsky wrote: > On 6/5/18 3:10 PM, Emilio Cobos Álvarez wrote: > > I personally would prefer one space at each side when using braces: > > > >  , mFoo { 0 } > > I think the reason people tend to think of this as not wanting spaces is > tha

Re: Coding style: brace initialization syntax

2018-06-05 Thread Boris Zbarsky
On 6/5/18 3:10 PM, Emilio Cobos Álvarez wrote: I personally would prefer one space at each side when using braces:  , mFoo { 0 } I think the reason people tend to think of this as not wanting spaces is that they are thinking of it as a constructor call. The parentheses syntax for initializ

Re: Coding style: brace initialization syntax

2018-06-05 Thread Emilio Cobos Álvarez
On 06/05/2018 06:48 PM, Eric Rahm wrote: Reading back through I think the consensus, at least for initializer lists was: 1. Prefer parenthesis, ie: , mBool(true) 2. If using braces, maintain the same spacing you would use with parenthesis, ie: , mStructWithoutCtor{42} 1. w

Re: Coding style: brace initialization syntax

2018-06-05 Thread Eric Rahm
Reading back through I think the consensus, at least for initializer lists was: 1. Prefer parenthesis, ie: , mBool(true) 2. If using braces, maintain the same spacing you would use with parenthesis, ie: , mStructWithoutCtor{42} 1. was pragmatic as this is what we already do, 2. was

Re: Coding style: brace initialization syntax

2018-06-05 Thread Jean-Yves Avenard
> On 5 Jun 2018, at 12:54 pm, bposteln...@mozilla.com wrote: > > I would like to resurrect this thread since it would help us a lot for bug > 1453795 to come up to a consensus on when to use bracelets and when to use > parenthesis. Also I must point out a thing here, that was also mentioned he

Re: Coding style: brace initialization syntax

2018-06-05 Thread bpostelnicu
I would like to resurrect this thread since it would help us a lot for bug 1453795 to come up to a consensus on when to use bracelets and when to use parenthesis. Also I must point out a thing here, that was also mentioned here earlier, that there are situations where we cannot use parenthesis.

Re: Coding style: brace initialization syntax

2018-04-13 Thread Botond Ballo
On Fri, Apr 13, 2018 at 11:06 AM, Emilio Cobos Álvarez wrote: >> If we are going to have brace-initialization intermixed with >> list-initialization (i.e. parentheses) in our codebase, I think we >> should prefer no space prior to the brace, for consistency. > > Hmm, consistency with parenthesis I

Re: Coding style: brace initialization syntax

2018-04-13 Thread Kartikaya Gupta
On Fri, Apr 13, 2018 at 11:06 AM, Emilio Cobos Álvarez wrote: > I'd be ok with that I guess, though it's more common each time? Also, is > there any case where you could use braces but not parenthesis? (I'm not a > C++ expert in this regard). I think there are. In particular if you're initializin

Re: Coding style: brace initialization syntax

2018-04-13 Thread Emilio Cobos Álvarez
On 4/13/18 4:49 PM, Nathan Froyd wrote: On Fri, Apr 13, 2018 at 9:37 AM, Emilio Cobos Álvarez wrote: Those changes I assume were generated with clang-format / clang-format-diff using the "Mozilla" coding style, so I'd rather ask people to agree in whether we prefer that style or other in order

Re: Coding style: brace initialization syntax

2018-04-13 Thread Gabriele Svelto
On 13/04/2018 16:49, Nathan Froyd wrote: > I lean towards the former here. I think the former is more common in > the code I've seen, but apparently the latter is "preferred C++" or > something? Yes, let's have a solid rationale if we're doing sweeping changes of this sort. Blindly following the

Re: Coding style: brace initialization syntax

2018-04-13 Thread Emilio Cobos Álvarez
On 4/13/18 4:22 PM, Boris Zbarsky wrote: So my take is that we should not use braced initializer syntax in constructor initializer lists.  The reason for that is that it makes it much harder to scan for where the constructor body starts. I don't think that's true in the general case where th

Re: Coding style: brace initialization syntax

2018-04-13 Thread Nathan Froyd
On Fri, Apr 13, 2018 at 9:37 AM, Emilio Cobos Álvarez wrote: > Those changes I assume were generated with clang-format / clang-format-diff > using the "Mozilla" coding style, so I'd rather ask people to agree in > whether we prefer that style or other in order to change that if needed. > > Would p

Re: Coding style: brace initialization syntax

2018-04-13 Thread Boris Zbarsky
On 4/13/18 9:40 AM, Alex Gaynor wrote: I don't have an opinion on the style change itself, but I'm a very strong +1 on just picking one and making sure clang-format enforces it. We need to fix clang-format to not produce output like https://hg.mozilla.org/mozilla-central/diff/d7d2f08e051c/dom/

Re: Coding style: brace initialization syntax

2018-04-13 Thread Boris Zbarsky
On 4/13/18 9:37 AM, Emilio Cobos Álvarez wrote: Would people agree to use:  , mIsRootDefined { false } Instead of:  , mIsRootDefined{ false } So my take is that we should not use braced initializer syntax in constructor initializer lists. The reason for that is that it makes it much har

Re: Coding style: brace initialization syntax

2018-04-13 Thread Alex Gaynor
I don't have an opinion on the style change itself, but I'm a very strong +1 on just picking one and making sure clang-format enforces it. Alex On Fri, Apr 13, 2018 at 9:37 AM, Emilio Cobos Álvarez wrote: > Sorry, I know, coding style thread... But it's Friday and this is somewhat > related to

Coding style: brace initialization syntax

2018-04-13 Thread Emilio Cobos Álvarez
Sorry, I know, coding style thread... But it's Friday and this is somewhat related to the previous thread. Bug 525063 added a lot of lines like: explicit TTextAttr(bool aGetRootValue) : mGetRootValue(aGetRootValue) , mIsDefined{ false } , mIsRootDefined{ false } {