lmi
[Top][All Lists]
Advanced

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

Re: [lmi] [lmi-commits] master b518132 4/4: Remove the latent defect jus


From: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] master b518132 4/4: Remove the latent defect just added
Date: Thu, 6 Sep 2018 03:04:28 +0200

On Wed,  5 Sep 2018 20:56:27 -0400 (EDT) Greg Chicares <address@hidden> wrote:

GC> branch: master
GC> commit b518132022d0dab59226f584778973265b71e532
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC> 
GC>     Remove the latent defect just added
[...]

 I've read the entire explanation, but this still looks weird to me. AFAICS
all this was done just to avoid dividing by potentially 0 lines_per_group_
(please correct me if I'm wrong). But if this is so, why not just use a
usual safe_divide(x, y) function which throws/asserts if y == 0 for the
initialization of groups_per_page_? Or, which I personally prefer, some
safe_denominator(x) function which simply returns x if it's non-zero and
throws if it's zero. This would seem to be much simpler and avoid the need
for a clumsy (IMHO) ctor_args_are_sane_ field. It is also arguably safer
because if you always use safe_xxx() when dividing integers, you don't have
to check that you had checked preconditions at some previous moment.

 What am I missing?
VZ


reply via email to

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