Re: Style guide clarity on C++-isms

2014-06-04 Thread Nicholas Nethercote
I've added the "tiny methods can be written in a single line" rule. Search for "TinyFunction" and "LargerFunction" at https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Classes Nick ___ dev-platform mailing list dev-platform@li

Re: Style guide clarity on C++-isms

2014-05-29 Thread Ehsan Akhgari
On 2014-05-29, 1:20 AM, L. David Baron wrote: On Wednesday 2014-05-28 21:03 -0700, Nicholas Nethercote wrote: static T inc(T& aPtr) { return IntrinsicAddSub::add(aPtr, 1); } static T dec(T& aPtr) { return IntrinsicAddSub::sub(aPtr, 1); } static T or_( T& aPtr, T aVal) { return __sync_fetch_an

Re: Style guide clarity on C++-isms

2014-05-28 Thread L. David Baron
On Wednesday 2014-05-28 21:03 -0700, Nicholas Nethercote wrote: > > static T inc(T& aPtr) { return IntrinsicAddSub::add(aPtr, 1); } > > static T dec(T& aPtr) { return IntrinsicAddSub::sub(aPtr, 1); } > > > static T or_( T& aPtr, T aVal) { return __sync_fetch_and_or(&aPtr, aVal); } > > static T xor

Re: Style guide clarity on C++-isms

2014-05-28 Thread Bobby Holley
On Wed, May 28, 2014 at 9:03 PM, Nicholas Nethercote wrote: > Furthermore, one-liners like this are actually pretty common, and > paving the cowpaths is often a good thing to do. > > Thoughts? > > Nick > +1. In a lot of cases, it seems pretty ridiculous to use 4 lines. See things like the Owning

Re: Style guide clarity on C++-isms

2014-05-28 Thread Nicholas Nethercote
On Tue, Jan 7, 2014 at 12:53 PM, Robert O'Callahan wrote: > > We have a lot of places where we write "void Method() { ... }" all on one > line for trivial setters and getters. I wonder if we should permit that. The conclusion for this question was "no", but I will ask for it to be reconsidered.

Re: Style guide clarity on C++-isms

2014-01-13 Thread Benjamin Smedberg
On 1/13/2014 2:33 PM, Milan Sreckovic wrote: I didn't mean no inlining :), I was just talking about the format: class A { public: inline int hello { return 4; } }; vs. class A { public: inline int hello(); }; inline int A::hello() { return 4; } We're pretty far from the origi

Re: Style guide clarity on C++-isms

2014-01-13 Thread Milan Sreckovic
I didn't mean no inlining :), I was just talking about the format: class A { public: inline int hello { return 4; } }; vs. class A { public: inline int hello(); }; inline int A::hello() { return 4; } -- - Milan On 2014-01-09, at 16:21 , Ehsan Akhgari wrote: > ... > >> As anothe

Re: Style guide clarity on C++-isms

2014-01-09 Thread Ehsan Akhgari
On 1/9/2014, 11:48 AM, Milan Sreckovic wrote: if the goal of the styles is the readability, do we know that people actually care which one of the described approaches we use, or is it also the "look, not all of these things are the same" that offends us? For example, I find the consistency of

Re: Style guide clarity on C++-isms

2014-01-09 Thread Martin Thomson
On 2014-01-09, at 08:48, Milan Sreckovic wrote: > For example, I find the consistency of the positioning of {} for the loops > and conditionals extremely important for readability. Outside of any real extremes, I’ve found that consistency is far more important than any personal preferences.

Re: Style guide clarity on C++-isms

2014-01-09 Thread Milan Sreckovic
if the goal of the styles is the readability, do we know that people actually care which one of the described approaches we use, or is it also the "look, not all of these things are the same" that offends us? For example, I find the consistency of the positioning of {} for the loops and conditi

Re: Style guide clarity on C++-isms

2014-01-08 Thread Trevor Saunders
On Wed, Jan 08, 2014 at 02:24:46PM -0500, Ehsan Akhgari wrote: > On 1/7/2014, 7:00 PM, Cameron McCormack wrote: > >Ehsan Akhgari wrote: > >>Exactly. If we require braces on their own lines for function bodies > >>everywhere, we wouldn't need to solve this! > > > >Are you sure? :) There are a bunch

Re: Style guide clarity on C++-isms

2014-01-08 Thread Ehsan Akhgari
On 1/7/2014, 7:00 PM, Cameron McCormack wrote: Ehsan Akhgari wrote: Exactly. If we require braces on their own lines for function bodies everywhere, we wouldn't need to solve this! Are you sure? :) There are a bunch of instances of class A { A(int aMember) : mMember(aMamber

Re: Style guide clarity on C++-isms

2014-01-07 Thread Cameron McCormack
Ehsan Akhgari wrote: Exactly. If we require braces on their own lines for function bodies everywhere, we wouldn't need to solve this! Are you sure? :) There are a bunch of instances of class A { A(int aMember) : mMember(aMamber) {} }; through the tree. Depends how the "b

Re: Style guide clarity on C++-isms

2014-01-07 Thread Ehsan Akhgari
On 1/7/2014, 6:18 PM, Cameron McCormack wrote: Benjamin Smedberg wrote: 1) Bracing of method bodies in a C++ class declaration Currently, C++ method bodies inline within a class declaration are documented to start on the next line, e.g. class B { public: void Method() { // Inline body brace is

Re: Style guide clarity on C++-isms

2014-01-07 Thread Cameron McCormack
Benjamin Smedberg wrote: 1) Bracing of method bodies in a C++ class declaration Currently, C++ method bodies inline within a class declaration are documented to start on the next line, e.g. class B { public: void Method() { // Inline body brace is on the next line, column 2 } }; Mozilla code w

Re: Style guide clarity on C++-isms

2014-01-07 Thread Ehsan Akhgari
On 1/7/2014, 3:53 PM, Robert O'Callahan wrote: I agree that those are the current best practices. We have a lot of places where we write "void Method() { ... }" all on one line for trivial setters and getters. I wonder if we should permit that. I'd rather if we didn't. Often times changing th

Re: Style guide clarity on C++-isms

2014-01-07 Thread Robert O'Callahan
I agree that those are the current best practices. We have a lot of places where we write "void Method() { ... }" all on one line for trivial setters and getters. I wonder if we should permit that. We have a lot of places where the opening brace of a class declaration is on the same line as the c

Style guide clarity on C++-isms

2014-01-07 Thread Benjamin Smedberg
There are a few C++-isms which vary widely across the tree and I'd like to clarify before we start any major refactorings. 1) Bracing of method bodies in a C++ class declaration Currently, C++ method bodies inline within a class declaration are documented to start on the next line, e.g. clas