lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [lmi-commits] master 9b3d0f1: Write explicitly-defaulted [cd]t


From: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] master 9b3d0f1: Write explicitly-defaulted [cd]tors inline, in class defn
Date: Mon, 6 Mar 2017 01:25:58 +0100

On Mon, 6 Mar 2017 00:04:11 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2017-03-05 20:55, Vadim Zeitlin wrote:
<...huge snip...>
GC> >  What do you think?
GC> 
GC> Yes, the latter...but with all the benefits above:
GC> 
GC>  - "values are clearly separated from the fields": We can use "the vertical
GC>    alignment convention used in lmi" for separation. (It's the quirk I'm
GC>    proudest of. I'm sure that two-dimensional information should be laid out
GC>    in two dimensions, whether or not I can convince anyone else.)

 Ah, of course I should have realized that you would want to lay it out
like this. It indeed looks weird to me (== I'm not convinced), but in my
attempt to achieve enlightenment I'll skip my long tangent about the
drawbacks of doing this and just accept the inevitable.

GC>  - "avoid repeating the type name": Absolutely.
GC> 
GC>  - "if we decide to explicitly default-initialize all members": Before 
meals,
GC>    which fingers on which hands do you wash? After meals, which teeth do you
GC>    brush? Maybe it's just my personality, but I have an intense desire for
GC>    regularity.

 I am actually half-convinced by this choice, although not at all by this
analogy because I don't have any self-washing fingers or self-cleaning
teeth, which would correspond to C++ objects with ctors, i.e. all of them
except for the primitive types.

 Because I haven't achieved enlightenment yet, let me explain why I think
it might be useful to omit the "{}": it's not just a question of saving a
couple of key strokes, but it also allows to immediately distinguish
between the sub-objects that we initialize in some special way and those
that we just let in their default state. However I admit that I don't have
any actual proof that being able to make this distinction is really useful.

GC> so I think this is the One True Way:
GC> 
GC>     int                decimals_ {0};
GC>     mce_rounding_style style_    {r_indeterminate};
GC>     std::string        gloss_    {};

 Amen.

 But just a question: where do the comments go in this style? I'm not
always talented/concise enough to fit them on the same line, but putting
them before the variable declaration risks destroying the vertical
alignment. Does it (and their rarity, generally speaking, in lmi code) mean
that comments for member declarations are discouraged?


GC> I will go back and regularize 9b3d0f1134744e6fe7e4bba8ffa5e8a655f7648b,
GC> but first let me disclose my full plan.
<...snip the plan...>

 Sure, there is absolutely nothing urgent about this (the only remotely
urgent thing from my point of view is fixing 64 bit build, but even this
can wait perfectly well until you finish with all this).

 Thanks!
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]