[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master 6730bd6 2/3: Add member irr_initialized_
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] [lmi-commits] master 6730bd6 2/3: Add member irr_initialized_ to keep track of state |
Date: |
Sat, 17 Feb 2018 13:14:52 +0100 |
On Fri, 16 Feb 2018 17:39:03 -0500 (EST) Greg Chicares <address@hidden> wrote:
GC> branch: master
GC> commit 6730bd6dd2c986297f7cbee10471e9006c985bc3
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC>
GC> Add member irr_initialized_ to keep track of state
GC>
GC> The calculation summary invokes CalculateIrrs() only when necessary,
GC> because IRR calculations affect responsiveness. The technique it uses
GC> to infer whether IRR calculations have already been run is extravagant
GC> and imperfect. This newly-added member offers an alternative that is
GC> simple, direct, and easier to perfect.
[...]
GC> diff --git a/ledger_invariant.hpp b/ledger_invariant.hpp
GC> index c2f4d38..628a5d0 100644
GC> --- a/ledger_invariant.hpp
GC> +++ b/ledger_invariant.hpp
[...]
GC> @@ -414,9 +415,15 @@ class LMI_SO LedgerInvariant
GC> // Special cases.
GC> int Length;
GC> int irr_precision_;
GC> - bool FullyInitialized; // I.e. by Init(BasicValues const*
b).
GC> + bool irr_initialized_; // CalculateIrrs() succeeded
GC> + bool FullyInitialized; // Init(BasicValues const*)
succeeded
GC> };
This is hardly very import, but I just wonder if we shouldn't use
initializers for the new members even when this would introduce (minor)
inconsistency with the existing code. I.e. in this case, I'd have written
"bool irr_initialized_ = false;" instead of adding it to the ctor because
it would make the changes more local and more obviously correct -- and
would resolve the resulting inconsistency later by initializing
"FullyInitialized" when declaring it too, rather than doing it in the ctor
as well.
Regards,
VZ
- Re: [lmi] [lmi-commits] master 6730bd6 2/3: Add member irr_initialized_ to keep track of state,
Vadim Zeitlin <=