lmi
[Top][All Lists]
Advanced

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

[lmi] Zebras in Git (was: [lmi-commits] master 2f7c850 1/8: Transplant i


From: Vadim Zeitlin
Subject: [lmi] Zebras in Git (was: [lmi-commits] master 2f7c850 1/8: Transplant implementation of a nested class)
Date: Tue, 24 Apr 2018 16:26:19 +0200

On Tue, 24 Apr 2018 07:02:35 -0400 (EDT) Greg Chicares <address@hidden> wrote:

GC> branch: master
GC> commit 2f7c85099382ba9ef124ba2a358f344ff9dfd42c
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC> 
GC>     Transplant implementation of a nested class
GC>     
GC>     Forward-declared a nested class, and moved its implementation out of
GC>     line, to promote readability. This change is merely textual: the
GC>     nestedness of the inner class is preserved.

 I'm mostly writing this message because wanted to share my discovery: if
you're not aware of it yet, as I wasn't myself, since Git 2.15 it's
possible to view moved lines in a diff in a nicer way. I tried doing "git
show 2f7c85" first, but this was really unclear, so I redid it as "git show
-w 2f7c85" which helped a bit as I saw that the code was probably just
moved, but it was difficult to be sure. So I searched around and found
about --color-moved option which, ideally still in combination with -w,
makes the commit perfectly readable using its default "zebra" option
(unfortunately I can't show it here with all the colours, so you'd have to
try it yourself to see it). I'm going to use it all the time now when moving
code around, to verify that I haven't unintentionally changed something in
the process -- and maybe it can be useful to you too.


GC>     Ideally, the inner class's implementation would be moved into the same
GC>     TU as the outer class; that's not possible because the outer class has
GC>     a std::vector of the inner class's type. See:
GC>       http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4371.html

 However, as long as I'm writing it anyhow, I can't help wondering why
exactly can't this class be moved in wx_table_generator.cpp? N4371 only
seems to require that it should be declared before the container is used
(possibly indirectly, i.e. from the default ctor), am I missing something?

 BTW, the latest version of this paper, and the one apparently included in
C++17 seems to be

        http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4510.html

(although there doesn't seem to be any important changes since N4371).

 Regards,
VZ


reply via email to

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