lmi
[Top][All Lists]
Advanced

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

Re: [lmi] [lmi-commits] master 6b93e91 11/12: Remove an unneeded auxilia


From: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] master 6b93e91 11/12: Remove an unneeded auxiliary function
Date: Wed, 23 May 2018 19:24:26 +0200

On Tue, 22 May 2018 17:09:23 -0400 (EDT) Greg Chicares <address@hidden> wrote:

GC> branch: master
GC> commit 6b93e91d9ae71d74998c2f1cc42cd87a0823ba22
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC> 
GC>     Remove an unneeded auxiliary function
[...]
GC>  wx_table_generator::wx_table_generator
GC>      (group_quote_style_tag                 // tag not referenced
GC>      ,std::vector<column_parameters> const& vc
GC> @@ -319,7 +303,7 @@ LMI_ASSERT(h / lh == int(1u + 
count_newlines(z.header)));
GC>  LMI_ASSERT(std::size_t(h / lh) == 1u + count_newlines(z.header));
GC>          // Store number of lines used by tallest unhidden header:
GC>          // output_headers() uses it to write all headers as a block.
GC> -        increase_to_if_smaller(max_header_lines_, std::size_t(h / lh));
GC> +        max_header_lines_ = std::max(max_header_lines_, std::size_t(h / 
lh));
GC>  
GC>          switch(z.elasticity)
GC>              {

 This is not terribly important, but I regret this function disappearance
because IMHO the old version was more clear than the new one: you need to
carefully scan the line now to confirm that the same variable appears in
both the LHS and the RHS, whereas it was immediately clear before.

 Of course, "max" is standard and shorter (OTOH increase_to_if_smaller()
could be renamed to just increase_to()) but it doesn't allow to avoid
specifying the variable name twice, which is a significant disadvantage.
It's unfortunate that C++ doesn't have "a max= b" to go with "a += b" etc
(Perl 6, of course, does).

 Regards,
VZ


reply via email to

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