In a project the size of mixxx (at least as they come up) every situation
should be enumerated and documented (to the extent possible in an os
project). This provides new developers the information to maintain
consistency. The code, especially in a large project that hasn't had the
formatting enforced, can't always be the example.
Whatever the project decides, consistency, and documentation are the most
important.

On Fri, Jun 5, 2015, 8:27 PM Owen Williams <owilli...@mixxx.org> wrote:

> Well my thinking is more aimed at humans reading code than the compiler
> reading it.  The function-style initialization looks like a class
> initialization, which makes CSAMPLE look heavier than it is.  What I've
> been taught is that what's most important is the syntactic clues that a
> reader picks up at the call site, without needing to dive into a call
> hierarchy.  A simple assignment of x = 0 is clearly low-weight.  x(0)
> could be anything from low-weight to extremely heavy.  If there is a
> low-weight way to write the assignment, that's preferred because it
> gives the reader a better sense of the true code complexity.
>
> For classes, it's a little more up in the air:
>
> auto blah = MyClassType(0) isn't wonderful, because the auto is sort of
> a waste of breath.  Just do MyClassType blah(0);  auto is ok for new
> pointers like auto* blah = new MyType(0);  because nothing is being
> repeated and it's super clear what type the auto has.
>
> It's all a matter of taste and I don't think it's necessary to enumerate
> every possible situation.
>
> owen
>
>
> On Sat, 2015-06-06 at 00:11 +0000, Gavin Swanson wrote:
> > are we in violent agreement then? Why not do the optimal thing in the
> > first place for consistency sake?  Rather than rely on the compiler to
> > do it for you. Especially in a case like this where the optimization
> > is no more work nor is it less readable.
> >
> >
> > On Fri, Jun 5, 2015, 7:38 PM Owen Williams <owilli...@mixxx.org>
> > wrote:
> >         That's what I said?
> >
> >         "The compiler is free to elide (remove) the temporary+copying
> >         whenever
> >         it can, but copy constructor must still be accessible"
> >
> >
> >
> >         On Fri, 2015-06-05 at 23:34 +0000, Gavin Swanson wrote:
> >         > http://stackoverflow.com/a/4470763
> >         >
> >         >
> >         > On Fri, Jun 5, 2015, 7:21 PM Owen Williams
> >         <owilli...@mixxx.org>
> >         > wrote:
> >         >         Since CSAMPLE is a simple type, assignment is best
> >         -- and when
> >         >         it works,
> >         >         assignment is the way to go (hurray for smart
> >         compilers
> >         >         eliding copies).
> >         >         With the form sample(0.0), it gives the impression
> >         that
> >         >         CSAMPLE is a
> >         >         complex type with a constructor.
> >         >
> >         >         On Fri, 2015-06-05 at 22:16 +0000, Gavin Swanson
> >         wrote:
> >         >         > CSAMPLE sample(0.0);
> >         >         >
> >         >         >
> >         >         > On Fri, Jun 5, 2015, 4:45 PM Owen Williams
> >         >         <owilli...@mixxx.org>
> >         >         > wrote:
> >         >         >         On Fri, 2015-06-05 at 22:30 +0200, Daniel
> >         Schürmann
> >         >         wrote:
> >         >         >
> >         >         >         > CSAMPLE sample = 0.0;
> >         >         >
> >         >         >         This one.  auto should really only be used
> >         when
> >         >         assigning from
> >         >         >         a
> >         >         >         function whose return value is obvious.
> >         >         >
> >         >         >
> >         >         >
> >         >         >
> >         >         >
> >         >
> >
>  
> ------------------------------------------------------------------------------
> >         >         >
> >          _______________________________________________
> >         >         >         Get Mixxx, the #1 Free MP3 DJ Mixing
> >         software Today
> >         >         >         http://mixxx.org
> >         >         >
> >         >         >
> >         >         >         Mixxx-devel mailing list
> >         >         >         Mixxx-devel@lists.sourceforge.net
> >         >         >
> >         >
> >         https://lists.sourceforge.net/lists/listinfo/mixxx-devel
> >         >
> >         >
> >
> >
>
>
>
------------------------------------------------------------------------------
_______________________________________________
Get Mixxx, the #1 Free MP3 DJ Mixing software Today
http://mixxx.org


Mixxx-devel mailing list
Mixxx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to