lmi
[Top][All Lists]
Advanced

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

[lmi] A task for November


From: Greg Chicares
Subject: [lmi] A task for November
Date: Thu, 01 Oct 2015 13:52:50 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0

[Nonessential and too risky for now.]

I've already made these improvements:

Default argument removed from class Ledger:
  http://svn.savannah.nongnu.org/viewvc?view=rev&root=lmi&revision=6304
Comment complaining about that default argument moved:
  http://svn.savannah.nongnu.org/viewvc?view=rev&root=lmi&revision=6305

But the job isn't finished, because we still have default arguments
in classes LedgerInvariant and LedgerVariant, and a borken reference
to that moved comment. I think we can do this:

In 'ledger_invariant.hpp':
-    // TODO ?? '100' here is poor. See inline comments on class
-    // Ledger's default ctor.
-    explicit LedgerInvariant(int len = 100);
+    explicit LedgerInvariant(int len);

In 'ledger_variant.hpp:
     // A default ctor is required because this class is used as a
-    // std::map's value_type.
+    // std::map's value_type.  It's okay to create it with an argument
+    // of zero because it's overwritten with an instance created with
+    // a nonzero argument.
     //
-    // TODO ?? '100' here is poor. See inline comments on class
-    // Ledger's default ctor.
-    LedgerVariant(int len = 100);
+    LedgerVariant(int len = 0);

In 'ledger.cpp':
-    ,ledger_invariant_     (new LedgerInvariant)
+    ,ledger_invariant_     (new LedgerInvariant(length))

I do realize that the added comment explaining why it's okay to do
something that looks silly because it'll be thrown away immediately
suggests that std::map might not be ideal here; but I'd rather avoid
major surgery and make a less ambitious change to clean up this
ickiness quickly, after Halloween.



reply via email to

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