[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
- Re: [lmi] [lmi-commits] master b518132 4/4: Remove the latent defect just added,
Vadim Zeitlin <=
- Re: [lmi] [lmi-commits] master b518132 4/4: Remove the latent defect just added, Greg Chicares, 2018/09/06
- Re: [lmi] [lmi-commits] master b518132 4/4: Remove the latent defect just added, Vadim Zeitlin, 2018/09/06
- Re: [lmi] [lmi-commits] master b518132 4/4: Remove the latent defect just added, Vadim Zeitlin, 2018/09/06
- [lmi] Remainder of integer division [Was: logic vs runtime errors], Greg Chicares, 2018/09/10
- Re: [lmi] Remainder of integer division, Vadim Zeitlin, 2018/09/10
- Re: [lmi] Remainder of integer division, Greg Chicares, 2018/09/11