lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master f98a2e9 3/4: Prefer preincrement when return


From: Greg Chicares
Subject: [lmi-commits] [lmi] master f98a2e9 3/4: Prefer preincrement when return value not used
Date: Wed, 23 May 2018 12:25:27 -0400 (EDT)

branch: master
commit f98a2e94c7f79a9f293b34d39938f3b0e1a1c2dc
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Prefer preincrement when return value not used
---
 accountvalue.cpp                | 12 ++++++------
 commutation_functions.cpp       |  4 ++--
 commutation_functions_test.cpp  | 12 ++++++------
 custom_io_0.cpp                 |  2 +-
 custom_io_1.cpp                 |  2 +-
 dbvalue.cpp                     | 14 +++++++-------
 docmanager_ex.cpp               |  8 ++++----
 fenv_guard.cpp                  |  2 +-
 financial.hpp                   |  2 +-
 financial_test.cpp              |  2 +-
 group_quote_pdf_gen_wx.cpp      |  8 ++++----
 ihs_avmly.cpp                   |  6 +++---
 ihs_basicval.cpp                | 10 +++++-----
 ihs_crc_comp.cpp                |  2 +-
 ihs_irc7702a.cpp                |  4 ++--
 input_sequence_entry.cpp        |  4 ++--
 interest_rates.cpp              | 38 +++++++++++++++++++-------------------
 ledger_base.cpp                 | 14 +++++++-------
 ledger_invariant.cpp            |  4 ++--
 ledger_pdf_generator_wx.cpp     |  2 +-
 ledger_variant.cpp              |  2 +-
 loads.cpp                       |  8 ++++----
 main_wx_test.cpp                | 14 +++++++-------
 round_to.hpp                    |  6 +++---
 round_to_test.cpp               |  2 +-
 solve.cpp                       |  2 +-
 wx_table_generator.cpp          |  6 +++---
 wx_test_calculation_summary.cpp |  4 ++--
 wx_test_date.hpp                |  4 ++--
 29 files changed, 100 insertions(+), 100 deletions(-)

diff --git a/accountvalue.cpp b/accountvalue.cpp
index a6dae2a..f83191f 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -239,7 +239,7 @@ double AccountValue::RunOneCell(mcenum_run_basis TheBasis)
 
     PerformSpecAmtStrategy();
 
-    for(Year = InforceYear; Year < BasicValues::GetLength(); Year++)
+    for(Year = InforceYear; Year < BasicValues::GetLength(); ++Year)
         {
         if(!ItLapsed)
             {
@@ -328,7 +328,7 @@ void AccountValue::DoYear
 
     // IHS !! Strategy here?
 
-    for(Month = a_InforceMonth; Month < 12; Month++)
+    for(Month = a_InforceMonth; Month < 12; ++Month)
         {
         DoMonth();
         if(ItLapsed)
@@ -484,7 +484,7 @@ void AccountValue::PerformSpecAmtStrategy()
 
     SA = round_specamt()(SA);
 
-    for(int j = 0; j < BasicValues::GetLength(); j++)
+    for(int j = 0; j < BasicValues::GetLength(); ++j)
         {
         InvariantValues().SpecAmt[j] = SA;
         }
@@ -542,7 +542,7 @@ void AccountValue::TxOptionChange()
     ActualSpecAmt = round_specamt()(ActualSpecAmt);
 
     // Carry the new spec amt forward into all future years.
-    for(int j = Year; j < BasicValues::GetLength(); j++)
+    for(int j = Year; j < BasicValues::GetLength(); ++j)
         {
         InvariantValues().SpecAmt[j] = ActualSpecAmt;
         }
@@ -572,7 +572,7 @@ void AccountValue::TxSpecAmtChange()
     ActualSpecAmt = std::max(MinSpecAmt, DeathBfts_->specamt()[Year]);
 
     // Carry the new spec amt forward into all future years.
-    for(int j = Year; j < BasicValues::GetLength(); j++)
+    for(int j = Year; j < BasicValues::GetLength(); ++j)
         {
         InvariantValues().SpecAmt[j] = ActualSpecAmt;
         }
@@ -909,7 +909,7 @@ void AccountValue::TxTakeWD()
             // Maybe it can't happen because of max WD defn?
 
             // Carry the new spec amt forward into all future years.
-            for(int j = Year; j < BasicValues::GetLength(); j++)
+            for(int j = Year; j < BasicValues::GetLength(); ++j)
                 {
                 InvariantValues().SpecAmt[j] = ActualSpecAmt;
                 }
diff --git a/commutation_functions.cpp b/commutation_functions.cpp
index 4d2b9cd..c780c54 100644
--- a/commutation_functions.cpp
+++ b/commutation_functions.cpp
@@ -76,7 +76,7 @@ OLCommFns::OLCommFns
     m.resize(    Length);
 
     d[0] = 1.0;
-    for(int j = 0; j < Length; j++)
+    for(int j = 0; j < Length; ++j)
         {
         LMI_ASSERT(-1.0 != i[j]);
         double v = 1.0 / (1.0 + i[j]);
@@ -140,7 +140,7 @@ ULCommFns::ULCommFns
     int months_per_period = 12 / periods_per_year;
 
     ad[0] = 1.0;
-    for(int j = 0; j < Length; j++)
+    for(int j = 0; j < Length; ++j)
         {
         LMI_ASSERT( 0.0 <= qc[j] && qc[j] <= 1.0);
         LMI_ASSERT(-1.0 <  ic[j]);
diff --git a/commutation_functions_test.cpp b/commutation_functions_test.cpp
index 9e67452..a51cf11 100644
--- a/commutation_functions_test.cpp
+++ b/commutation_functions_test.cpp
@@ -178,7 +178,7 @@ void TestEckleyTable2()
     {
     double tolerance = 0.0000005;
     double worst_discrepancy = 0.0;
-    for(unsigned int j = 0; j < coi.size(); j++)
+    for(unsigned int j = 0; j < coi.size(); ++j)
         {
         double d0 = std::fabs(nsp    [j] - Ax[j]);
         double d1 = std::fabs(annuity[j] - ax[j]);
@@ -213,7 +213,7 @@ void TestEckleyTable2()
     {
     double tolerance = 0.000005;
     double worst_discrepancy = 0.0;
-    for(unsigned int j = 0; j < coi.size(); j++)
+    for(unsigned int j = 0; j < coi.size(); ++j)
         {
         double d0 = std::fabs(premium[j] - Px[j] * .001);
         double d1 = std::fabs(reserve[j] - Vx[j] * .001);
@@ -300,7 +300,7 @@ void TestEckleyTables3and4()
 
     double tolerance = 0.000005;
     double worst_discrepancy = 0.0;
-    for(unsigned int j = 0; j < coi.size(); j++)
+    for(unsigned int j = 0; j < coi.size(); ++j)
         {
         double d0 = std::fabs(premium[j] - Px[j] * .001);
         double d1 = std::fabs(reserve[j] - Vx[j] * .001);
@@ -383,7 +383,7 @@ void TestEckleyTable5()
 
     double tolerance = 0.0000005;
     double worst_discrepancy = 0.0;
-    for(unsigned int j = 0; j < coi.size(); j++)
+    for(unsigned int j = 0; j < coi.size(); ++j)
         {
         double d0 = std::fabs(CF.aD()[j]        - Dx  [j]);
         double d1 = std::fabs(CF.kD()[j] / 12.0 - Dx12[j]);
@@ -533,7 +533,7 @@ void Test_1954_1958_IET_3pct()
 
     double tolerance = 0.01;
     double worst_discrepancy = 0.0;
-    for(unsigned int j = 0; j < q.size(); j++)
+    for(unsigned int j = 0; j < q.size(); ++j)
         {
         double d0 = std::fabs(Dx[0] * CF.D()[j] - Dx[j]);
         double d1 = std::fabs(Dx[0] * CF.N()[j] - Nx[j]);
@@ -653,7 +653,7 @@ void Test_1980_CSO_Male_ANB()
 
     double tolerance = 1.0e-13;
     double worst_discrepancy = 0.0;
-    for(unsigned int j = 0; j < q.size(); j++)
+    for(unsigned int j = 0; j < q.size(); ++j)
         {
         double d0 = std::fabs(reserve[j] - Vx[j]);
         worst_discrepancy = std::max(worst_discrepancy, d0);
diff --git a/custom_io_0.cpp b/custom_io_0.cpp
index 8981910..a5ff1e2 100644
--- a/custom_io_0.cpp
+++ b/custom_io_0.cpp
@@ -519,7 +519,7 @@ void custom_io_0_write(Ledger const& ledger_values, 
std::string const& filename)
     os.setf(std::ios_base::fixed, std::ios_base::floatfield);
 
     int max_duration = static_cast<int>(Invar.EndtAge - Invar.Age);
-    for(int j = 0; j < max_duration; j++)
+    for(int j = 0; j < max_duration; ++j)
         {
         os
             << std::setprecision(0)
diff --git a/custom_io_1.cpp b/custom_io_1.cpp
index 419c579..10167e1 100644
--- a/custom_io_1.cpp
+++ b/custom_io_1.cpp
@@ -388,7 +388,7 @@ void custom_io_1_write(Ledger const& ledger_values, 
std::string const& filename)
     os.setf(std::ios_base::fixed, std::ios_base::floatfield);
 
     int max_duration = static_cast<int>(Invar.EndtAge - Invar.Age);
-    for(int j = 0; j < max_duration; j++)
+    for(int j = 0; j < max_duration; ++j)
         {
         os
             << std::setprecision(2)
diff --git a/dbvalue.cpp b/dbvalue.cpp
index c5f9fbe..a8b1830 100644
--- a/dbvalue.cpp
+++ b/dbvalue.cpp
@@ -212,7 +212,7 @@ void database_entity::reshape(std::vector<int> const& 
new_dims)
     std::vector<int> src_idx(e_number_of_axes); // indexes '*this'
 
     std::vector<int> working_idx(e_number_of_axes);
-    for(int j = 0; j < n_iter; j++)
+    for(int j = 0; j < n_iter; ++j)
         {
         int z = j;
         std::vector<int>::const_iterator i = new_dims.begin();
@@ -222,8 +222,8 @@ void database_entity::reshape(std::vector<int> const& 
new_dims)
             LMI_ASSERT(0 != *i);
             *w = z % *i;
             z /= *i;
-            i++;
-            w++;
+            ++i;
+            ++w;
             }
         LMI_ASSERT(0 == z);
 
@@ -252,7 +252,7 @@ double& database_entity::operator[](std::vector<int> const& 
index)
     LMI_ASSERT(e_number_of_axes == index.size());
 
     int z = 0;
-    for(unsigned int j = 0; j < e_number_of_axes; j++)
+    for(unsigned int j = 0; j < e_number_of_axes; ++j)
         {
         if(1 != axis_lengths_[j])
             {
@@ -281,7 +281,7 @@ double const* database_entity::operator[](database_index 
const& idx) const
     LMI_ASSERT(e_number_of_axes == 1 + index.size());
 
     int z = 0;
-    for(unsigned int j = 0; j < e_number_of_axes - 1; j++)
+    for(unsigned int j = 0; j < e_number_of_axes - 1; ++j)
         {
         if(1 != axis_lengths_[j])
             {
@@ -392,8 +392,8 @@ void database_entity::assert_invariants() const
                 << LMI_FLUSH
                 ;
             }
-        ai++;
-        mi++;
+        ++ai;
+        ++mi;
         }
 
     if(max_dims.back() < axis_lengths_.back())
diff --git a/docmanager_ex.cpp b/docmanager_ex.cpp
index 15d0417..4b65169 100644
--- a/docmanager_ex.cpp
+++ b/docmanager_ex.cpp
@@ -213,13 +213,13 @@ wxDocTemplate* DocManagerEx::SelectDocumentType
     int i;
     int n = 0;
 
-    for(i = 0; i < noTemplates; i++)
+    for(i = 0; i < noTemplates; ++i)
     {
         if(templates[i]->IsVisible())
         {
             int j;
             bool want = TRUE;
-            for(j = 0; j < n; j++)
+            for(j = 0; j < n; ++j)
             {
                 //filter out NOT unique documents + view combinations
                 if( templates[i]->GetDocumentName() == 
data[j]->GetDocumentName() &&
@@ -245,9 +245,9 @@ wxDocTemplate* DocManagerEx::SelectDocumentType
         // are typically short.
         int j;
         n = strings.Count();
-        for(i = 0; i < n; i++)
+        for(i = 0; i < n; ++i)
         {
-            for(j = 0; j < noTemplates; j++)
+            for(j = 0; j < noTemplates; ++j)
             {
                 if(strings[i] == templates[j]->GetDescription())
                     data[i] = templates[j];
diff --git a/fenv_guard.cpp b/fenv_guard.cpp
index 223048e..83c8908 100644
--- a/fenv_guard.cpp
+++ b/fenv_guard.cpp
@@ -27,7 +27,7 @@
 
 fenv_guard::fenv_guard()
 {
-    instance_count_++;
+    ++instance_count_;
     fenv_initialize();
 }
 
diff --git a/financial.hpp b/financial.hpp
index c58b5d7..c38bbae 100644
--- a/financial.hpp
+++ b/financial.hpp
@@ -177,7 +177,7 @@ OutputIterator const irr
     // of the interval we want to pass to the subfunction. We could
     // use an auxiliary variable in the loop body instead:
     //   pmts_end = pmts;
-    //   pmts_end++;
+    //   ++pmts_end;
     // and then increment 'pmts' in a place that seems more normal,
     // but timing tests show that to be significantly slower with
     // some of the compilers we use, and we have demonstrated that
diff --git a/financial_test.cpp b/financial_test.cpp
index d5f7f25..18a6edd 100644
--- a/financial_test.cpp
+++ b/financial_test.cpp
@@ -192,7 +192,7 @@ int test_main(int, char*[])
     static double const one_plus_i = 1.0L + i;
     std::vector<double> accum_p(p.size());
     accum_p[0] = p[0] * one_plus_i;
-    for(unsigned int j = 1; j < p.size(); j++)
+    for(unsigned int j = 1; j < p.size(); ++j)
         {
         accum_p[j] = (accum_p[j - 1] + p[j]) * one_plus_i;
         }
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 93a06e5..78ff8a3 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -648,7 +648,7 @@ void group_quote_pdf_generator_wx::add_ledger(Ledger const& 
ledger)
     else
         {
         rows_.push_back(rd);
-        row_num_++;
+        ++row_num_;
         }
 }
 
@@ -758,7 +758,7 @@ void group_quote_pdf_generator_wx::save(std::string const& 
output_filename)
         = remaining_space < (footer_height + 2 * vert_skip);
     if(footer_on_its_own_page)
         {
-        total_pages++;
+        ++total_pages;
         }
 
     int current_page = 1;
@@ -771,7 +771,7 @@ void group_quote_pdf_generator_wx::save(std::string const& 
output_filename)
             {
             output_page_number_and_version(pdf_writer, total_pages, 
current_page);
 
-            current_page++;
+            ++current_page;
             pdf_writer.dc().StartPage();
 
             pos_y = pdf_writer.get_vert_margin();
@@ -783,7 +783,7 @@ void group_quote_pdf_generator_wx::save(std::string const& 
output_filename)
         {
         output_page_number_and_version(pdf_writer, total_pages, current_page);
 
-        current_page++;
+        ++current_page;
         pdf_writer.dc().StartPage();
 
         pos_y = pdf_writer.get_vert_margin();
diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index 25801f7..5e2053c 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -751,7 +751,7 @@ void AccountValue::ChangeSpecAmtBy(double delta)
     AddSurrChgLayer(Year, std::max(0.0, ActualSpecAmt - prior_specamt));
 
     // Carry the new specamt forward into all future years.
-    for(int j = Year; j < BasicValues::GetLength(); j++)
+    for(int j = Year; j < BasicValues::GetLength(); ++j)
         {
 // TODO ?? This seems wrong. If we're changing something that doesn't
 // vary across bases, why do we change it for all bases?
@@ -788,7 +788,7 @@ void AccountValue::ChangeSupplAmtBy(double delta)
     // At least for now, there is no effect on surrender charges.
 
     // Carry the new supplemental amount forward into all future years.
-    for(int j = Year; j < BasicValues::GetLength(); j++)
+    for(int j = Year; j < BasicValues::GetLength(); ++j)
         {
         InvariantValues().TermSpecAmt[j] = TermSpecAmt;
         }
@@ -1728,7 +1728,7 @@ void AccountValue::EndTermRider(bool convert)
     TermSpecAmt = 0.0;
     TermDB = 0.0;
     // Carry the new term spec amt forward into all future years.
-    for(int j = Year; j < BasicValues::GetLength(); j++)
+    for(int j = Year; j < BasicValues::GetLength(); ++j)
         {
         InvariantValues().TermSpecAmt[j] = TermSpecAmt;
         }
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 26ae3c1..58a49ff 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -351,7 +351,7 @@ double BasicValues::InvestmentManagementFee() const
     double total_sepacct_allocations = 0.0;
     FundData const& Funds = *FundData_;
 
-    for(int j = 0; j < Funds.GetNumberOfFunds(); j++)
+    for(int j = 0; j < Funds.GetNumberOfFunds(); ++j)
         {
         double weight;
         // If average of all funds, then use equal weights, but
@@ -1712,7 +1712,7 @@ std::vector<double> BasicValues::GetTable
             );
         double n = yare_input_.NonsmokerProportion;
         double s = 1.0 - n;
-        for(int j = 0; j < GetLength(); j++)
+        for(int j = 0; j < GetLength(); ++j)
             {
             BlendedTable.push_back(s * S[j] + n * N[j]);
             }
@@ -1747,7 +1747,7 @@ std::vector<double> BasicValues::GetTable
         double m_tpx = 1.0;
         double tpx;
         double tpx_prev = 1.0;
-        for(int j = 0; j < GetLength(); j++)
+        for(int j = 0; j < GetLength(); ++j)
             {
             f_tpx *= (1 - F[j]);
             m_tpx *= (1 - M[j]);
@@ -1758,7 +1758,7 @@ std::vector<double> BasicValues::GetTable
 */
 
 ///*
-        for(int j = 0; j < GetLength(); j++)
+        for(int j = 0; j < GetLength(); ++j)
             {
             BlendedTable.push_back(f * F[j] + m * M[j]);
             }
@@ -1800,7 +1800,7 @@ std::vector<double> BasicValues::GetTable
         double s = 1.0 - n;
         double m = yare_input_.MaleProportion;
         double f = 1.0 - m;
-        for(int j = 0; j < GetLength(); j++)
+        for(int j = 0; j < GetLength(); ++j)
             {
             BlendedTable.push_back
                 (   f * (s * FS[j] + n * FN[j])
diff --git a/ihs_crc_comp.cpp b/ihs_crc_comp.cpp
index 30c80c1..1fd9a40 100644
--- a/ihs_crc_comp.cpp
+++ b/ihs_crc_comp.cpp
@@ -428,7 +428,7 @@ int try_main(int argc, char* argv[])
     line_type state = initial;
     line_type old_state;
 
-    for(int j = 0; ; j++)
+    for(int j = 0; ; ++j)
         {
         std::getline(is1, line1);
         std::getline(is2, line2);
diff --git a/ihs_irc7702a.cpp b/ihs_irc7702a.cpp
index 8fd994a..d5424a0 100644
--- a/ihs_irc7702a.cpp
+++ b/ihs_irc7702a.cpp
@@ -380,7 +380,7 @@ bool Irc7702A::UpdateEOM7702A()
 {
     if(!(Ignore || IsMec))
         {
-        TestPeriodDur++;
+        ++TestPeriodDur;
         }
     return IsMec;
 }
@@ -1009,7 +1009,7 @@ void Irc7702A::TestBftDecrease(double a_NewBft)
     for
         (int j = 0
         ; j < std::min(TestPeriodLen, 1 + TestPeriodDur) && prem_iter != 
Pmts.end()
-        ; j++, prem_iter++
+        ; ++j, ++prem_iter
         )
         {
         cum_prem += *prem_iter;
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index 2a06fbe..1bfa391 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -223,7 +223,7 @@ class InputSequenceEditor
         explicit LayoutOnceGuard(InputSequenceEditor* editor)
             :editor_(editor)
         {
-            editor_->layout_freeze_count_++;
+            ++editor_->layout_freeze_count_;
         }
 
         ~LayoutOnceGuard()
@@ -718,7 +718,7 @@ void InputSequenceEditor::insert_row(int new_row)
         sizer_->SetMinSize(sizer_->CalcMin());
         }
 
-    rows_count_++;
+    ++rows_count_;
     duration_scalars_.insert(duration_scalars_.begin() + new_row, -1);
 
     set_tab_order();
diff --git a/interest_rates.cpp b/interest_rates.cpp
index a3ab03c..55c0976 100644
--- a/interest_rates.cpp
+++ b/interest_rates.cpp
@@ -193,7 +193,7 @@ void convert_interest_rates
     double previous_annual_gross_rate = 0.0;
     double previous_spread            = 0.0;
     double previous_floor             = 0.0;
-    for(unsigned int j = 0; j < length; j++)
+    for(unsigned int j = 0; j < length; ++j)
         {
         if
             (
@@ -413,16 +413,16 @@ void InterestRates::Initialize(BasicValues const& v)
 
     // Paranoid check.
     unsigned int z = static_cast<unsigned int>(Length_);
-    for(int i = mce_annual_rate; i < mc_n_rate_periods; i++)
+    for(int i = mce_annual_rate; i < mc_n_rate_periods; ++i)
         {
-        for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+        for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
             {
             // The next line gets executed more than once with
             // identical semantics, but it's cheap, and writing it
             // to avoid that little problem would make it unclear.
             LMI_ASSERT(z == GenAcctGrossRate_           [j]   .size());
             LMI_ASSERT(z == GenAcctNetRate_          [i][j]   .size());
-            for(int k = mce_sep_full; k < mc_n_sep_bases; k++)
+            for(int k = mce_sep_full; k < mc_n_sep_bases; ++k)
                 {
                 LMI_ASSERT(z == SepAcctGrossRate_          [k].size());
                 LMI_ASSERT(z == SepAcctNetRate_      [i][j][k].size());
@@ -479,7 +479,7 @@ void InterestRates::InitializeGeneralAccountRates()
         GenAcctNetRate_[mce_monthly_rate][mce_gen_mdpt] = Zero_;
         }
 
-    for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+    for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
         {
         convert_interest_rates
             (GenAcctGrossRate_[j]
@@ -499,13 +499,13 @@ void InterestRates::InitializeSeparateAccountRates()
     SepAcctFloor_.assign(Length_, -1.0);
     if(!NeedSepAcctRates_)
         {
-        for(int i = mce_annual_rate; i < mc_n_rate_periods; i++)
+        for(int i = mce_annual_rate; i < mc_n_rate_periods; ++i)
             {
-            for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+            for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
                 {
                 SepAcctGrossRate_[mce_sep_zero] = Zero_;
                 SepAcctGrossRate_[mce_sep_half] = Zero_;
-                for(int k = mce_sep_full; k < mc_n_sep_bases; k++)
+                for(int k = mce_sep_full; k < mc_n_sep_bases; ++k)
                     {
                     SepAcctNetRate_[i][j][k] = Zero_;
                     }
@@ -523,7 +523,7 @@ void InterestRates::InitializeSeparateAccountRates()
     std::transform(miscellaneous_charges.begin(), miscellaneous_charges.end(), 
ExtraSepAcctCharge_.begin(), miscellaneous_charges.begin(), 
std::plus<double>());
 
     std::vector<double> total_charges[mc_n_gen_bases];
-    for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+    for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
         {
         if(mce_gen_mdpt == j)
             {
@@ -551,7 +551,7 @@ void InterestRates::InitializeSeparateAccountRates()
             << "Separate-account rate is unexpectedly a net rate."
             << LMI_FLUSH
             ;
-        for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+        for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
             {
             if(mce_gen_mdpt == j)
                 {
@@ -581,9 +581,9 @@ void InterestRates::InitializeSeparateAccountRates()
         ,std::bind1st(std::multiplies<double>(), 0.5)
         );
 
-    for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+    for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
         {
-        for(int k = mce_sep_full; k < mc_n_sep_bases; k++)
+        for(int k = mce_sep_full; k < mc_n_sep_bases; ++k)
             {
             if(mce_gen_mdpt == j)
                 {
@@ -609,9 +609,9 @@ void InterestRates::InitializeLoanRates()
 {
     if(!NeedLoanRates_)
         {
-        for(int i = mce_annual_rate; i < mc_n_rate_periods; i++)
+        for(int i = mce_annual_rate; i < mc_n_rate_periods; ++i)
             {
-            for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+            for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
                 {
                 RegLnCredRate_[i][j] = Zero_;
                 RegLnDueRate_ [i][j] = Zero_;
@@ -640,7 +640,7 @@ void InterestRates::InitializeLoanRates()
         (  mce_fixed_loan_rate == LoanRateType_
         || each_equal(PrefLoanRateDecr_, 0.0)
         );
-    for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+    for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
         {
         RegLnDueRate_[mce_annual_rate][j] = PublishedLoanRate_;
         PrfLnDueRate_[mce_annual_rate][j] = PublishedLoanRate_;
@@ -662,7 +662,7 @@ void InterestRates::InitializeLoanRates()
         assign_midpoint(PrfLoanSpread_[mce_gen_mdpt], 
PrfLoanSpread_[mce_gen_guar], PrfLoanSpread_[mce_gen_curr]);
         }
 
-    for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+    for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
         {
         convert_interest_rates
             (RegLnDueRate_[mce_annual_rate ][j]
@@ -741,9 +741,9 @@ void InterestRates::InitializeHoneymoonRates()
 {
     if(!NeedHoneymoonRates_)
         {
-        for(int i = mce_annual_rate; i < mc_n_rate_periods; i++)
+        for(int i = mce_annual_rate; i < mc_n_rate_periods; ++i)
             {
-            for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+            for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
                 {
                 HoneymoonValueRate_      [i][j] = Zero_;
                 PostHoneymoonGenAcctRate_[i][j] = Zero_;
@@ -760,7 +760,7 @@ void InterestRates::InitializeHoneymoonRates()
     // implement it for honeymoon rates too.
     LMI_ASSERT(mce_credited_rate == GenAcctRateType_);
 
-    for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+    for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
         {
         convert_interest_rates
             (GenAcctNetRate_    [mce_annual_rate ][j]
diff --git a/ledger_base.cpp b/ledger_base.cpp
index 42b01e5..3f3e95e 100644
--- a/ledger_base.cpp
+++ b/ledger_base.cpp
@@ -112,7 +112,7 @@ void LedgerBase::Copy(LedgerBase const& obj)
     for
         (double_vector_map::iterator svmi = AllVectors.begin()
         ;svmi != AllVectors.end()
-        ;svmi++, obj_svmi++
+        ;++svmi, ++obj_svmi
         )
         {
         *(*svmi).second = *(*obj_svmi).second;
@@ -122,7 +122,7 @@ void LedgerBase::Copy(LedgerBase const& obj)
     for
         (scalar_map::iterator svmi = AllScalars.begin()
         ;svmi != AllScalars.end()
-        ;svmi++, obj_sci++
+        ;++svmi, ++obj_sci
         )
         {
         *(*svmi).second = *(*obj_sci).second;
@@ -132,7 +132,7 @@ void LedgerBase::Copy(LedgerBase const& obj)
     for
         (string_map::iterator svmi = Strings.begin()
         ;svmi != Strings.end()
-        ;svmi++, obj_sti++
+        ;++svmi, ++obj_sti
         )
         {
         *(*svmi).second = *(*obj_sti).second;
@@ -240,7 +240,7 @@ LedgerBase& LedgerBase::PlusEq
     for
         (double_vector_map::iterator svmi = BegYearVectors.begin()
         ;svmi != BegYearVectors.end()
-        ;svmi++, a_Addend_svmi++
+        ;++svmi, ++a_Addend_svmi
         )
         {
         x_plus_eq_y_times_z
@@ -259,7 +259,7 @@ LedgerBase& LedgerBase::PlusEq
     for
         (double_vector_map::iterator svmi = EndYearVectors.begin()
         ;svmi != EndYearVectors.end()
-        ;svmi++, a_Addend_svmi++
+        ;++svmi, ++a_Addend_svmi
         )
         {
         x_plus_eq_y_times_z
@@ -278,7 +278,7 @@ LedgerBase& LedgerBase::PlusEq
     for
         (double_vector_map::iterator svmi = ForborneVectors.begin()
         ;svmi != ForborneVectors.end()
-        ;svmi++, a_Addend_svmi++
+        ;++svmi, ++a_Addend_svmi
         )
         {
         x_plus_eq_y_times_z
@@ -293,7 +293,7 @@ LedgerBase& LedgerBase::PlusEq
     for
         (scalar_map::iterator ssmi = ScalableScalars.begin()
         ;ssmi != ScalableScalars.end()
-        ;ssmi++, a_Addend_ssmi++
+        ;++ssmi, ++a_Addend_ssmi
         )
         {
         *(*ssmi).second += *(*a_Addend_ssmi).second * a_Inforce[0];
diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 3d3dece..7162dd6 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -572,7 +572,7 @@ void LedgerInvariant::Init(BasicValues const* b)
         v.insert(v.end(), expected_number_of_funds - v.size(), 0.0);
         }
 
-    for(int j = 0; j < number_of_funds; j++)
+    for(int j = 0; j < number_of_funds; ++j)
         {
         FundNumbers.push_back(j);
         FundNames.push_back(b->FundData_->GetFundInfo(j).LongName());
@@ -960,7 +960,7 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant 
const& a_Addend)
     // ET !! This is of the form 'x = (lengthof x) take y'.
     // Make sure total (this) has enough years to add all years of a_Addend to.
     LMI_ASSERT(a_Addend.Length <= Length);
-    for(int j = 0; j < Max; j++)
+    for(int j = 0; j < Max; ++j)
         {
         if(0.0 == N[j])
             break;
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 1df4a83..cc111b3 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -1194,7 +1194,7 @@ class numbered_page : public page_with_footer
 
         writer.dc().StartPage();
 
-        this_page_number_++;
+        ++this_page_number_;
         extra_pages_--;
     }
 
diff --git a/ledger_variant.cpp b/ledger_variant.cpp
index c760593..e05a862 100644
--- a/ledger_variant.cpp
+++ b/ledger_variant.cpp
@@ -302,7 +302,7 @@ LedgerVariant& LedgerVariant::PlusEq
     InitMlyPolFee               = std::max(InitMlyPolFee        , 
a_Addend.InitMlyPolFee        );
     InitAnnLoanCredRate         = a_Addend.InitAnnLoanCredRate;
     // ET !! This is of the form 'x = (lengthof x) take y'.
-    for(int j = 0; j < a_Addend.Length; j++)
+    for(int j = 0; j < a_Addend.Length; ++j)
         {
         MlySAIntRate              [j]  = a_Addend.MlySAIntRate              
[j];
         MlyGAIntRate              [j]  = a_Addend.MlyGAIntRate              
[j];
diff --git a/loads.cpp b/loads.cpp
index ad27c89..bff8e5d 100644
--- a/loads.cpp
+++ b/loads.cpp
@@ -82,7 +82,7 @@ void Loads::Allocate(int length)
     target_total_load_     .resize(mc_n_gen_bases);
     excess_total_load_     .resize(mc_n_gen_bases);
 
-    for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+    for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
         {
         monthly_policy_fee_    [j].resize(length);
         annual_policy_fee_     [j].resize(length);
@@ -143,7 +143,7 @@ void Loads::Calculate(load_details const& details)
 {
     premium_tax_load_.assign(details.length_, details.premium_tax_load_);
 
-    for(int j = mce_gen_curr; j != mc_n_gen_bases; j++)
+    for(int j = mce_gen_curr; j != mc_n_gen_bases; ++j)
         {
         // ET !! PETE could support an apply-and-assign operation, e.g.:
         // apply_to_self
@@ -175,7 +175,7 @@ void Loads::Calculate(load_details const& details)
                 )
             );
 
-        for(int j = mce_gen_curr; j != mc_n_gen_bases; j++)
+        for(int j = mce_gen_curr; j != mc_n_gen_bases; ++j)
             {
 #if 0
 // ET !! As for rounding, we do want an expression-template library
@@ -231,7 +231,7 @@ void Loads::Calculate(load_details const& details)
     // last two): they're always deducted whether or not any payment
     // is made.
 
-    for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
+    for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
         {
         if(mce_gen_mdpt == j)
             {
diff --git a/main_wx_test.cpp b/main_wx_test.cpp
index 10782f7..c0b9605 100644
--- a/main_wx_test.cpp
+++ b/main_wx_test.cpp
@@ -246,7 +246,7 @@ void application_test::process_test_name(char const* name)
     if (name[0] == '-')
         {
         run = run_no;
-        name++; // Skip the leading minus sign.
+        ++name; // Skip the leading minus sign.
         }
     else
         {
@@ -391,7 +391,7 @@ bool application_test::process_command_line(int& argc, 
char* argv[])
             }
         else
             {
-            n++;
+            ++n;
             }
         }
 
@@ -445,7 +445,7 @@ TestsResults application_test::run()
         if ((run_all_ && i.run != run_no) || i.run == run_yes)
             {
             std::string error;
-            results.total++;
+            ++results.total;
 
             char const* const name = i.get_name();
 
@@ -459,12 +459,12 @@ TestsResults application_test::run()
                 wxLog::FlushActive();
                 wxPrintf("time=%ldms (for %s)\n", sw.Time(), name);
                 wxPrintf("%s: ok\n", name);
-                results.passed++;
+                ++results.passed;
                 }
             catch(test_skipped_exception const& e)
                 {
                 wxPrintf("%s: skipped (%s)\n", name, e.what());
-                results.skipped++;
+                ++results.skipped;
                 }
             catch(std::exception const& e)
                 {
@@ -477,7 +477,7 @@ TestsResults application_test::run()
 
             if (!error.empty())
                 {
-                results.failed++;
+                ++results.failed;
 
                 // Keep everything on a single line to ensure the full text of
                 // the error appears if the output is filtered by the test name
@@ -587,7 +587,7 @@ wxWindow* wx_test_focus_controller_child(MvcController& 
dialog, char const* name
             {
             // We found the notebook, now we can use it to make the page
             // containing the target window current.
-            for(size_t n = 0; n < book->GetPageCount(); n++)
+            for(size_t n = 0; n < book->GetPageCount(); ++n)
                 {
                 if(book->GetPage(n) == maybe_page)
                     {
diff --git a/round_to.hpp b/round_to.hpp
index bf35697..7ab2096 100644
--- a/round_to.hpp
+++ b/round_to.hpp
@@ -165,7 +165,7 @@ RealType round_up(RealType r)
         // in type 'RealType'. Then '++' doesn't increment it; it adds
         // unity, which doesn't change the value. That's OK though: in
         // that case, this code is unreachable.
-        i_part++;
+        ++i_part;
         }
     return i_part;
 }
@@ -202,7 +202,7 @@ RealType round_trunc(RealType r)
         }
     else if(RealType(0) < f_part && i_part < RealType(0))
         {
-        i_part++;
+        ++i_part;
         }
     return i_part;
 }
@@ -235,7 +235,7 @@ RealType round_near(RealType r)
             }
         else if(RealType(0) < f_part)
             {
-            i_part++;
+            ++i_part;
             }
         }
     return i_part;
diff --git a/round_to_test.cpp b/round_to_test.cpp
index c61f02d..670771f 100644
--- a/round_to_test.cpp
+++ b/round_to_test.cpp
@@ -467,7 +467,7 @@ int test_all_modes(bool synchronize)
     // created once and used many times, like this:
     round_to<double> const RoundToNearestHundredth(2, r_to_nearest);
     double sample_value = 1.0;
-    for(int j = 0; j < 1000; j++)
+    for(int j = 0; j < 1000; ++j)
         {
         sample_value *= 1.05;
         sample_value = RoundToNearestHundredth(sample_value);
diff --git a/solve.cpp b/solve.cpp
index 0d345e3..f463ebf 100644
--- a/solve.cpp
+++ b/solve.cpp
@@ -82,7 +82,7 @@ double SolveTest()
     double Negative = 0.0;
 
     // IHS !! Start counting only at end of no-lapse period--lmi does that 
already.
-    for(int j = 0; j < ThatSolveTgtYear; j++)
+    for(int j = 0; j < ThatSolveTgtYear; ++j)
         {
         Negative = std::min
             (Negative
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 857053d..931a57a 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -385,11 +385,11 @@ void wx_table_generator::compute_column_widths()
             continue;
             }
 
-        n_columns++;
+        ++n_columns;
 
         if(i.is_elastic())
             {
-            n_expand++;
+            ++n_expand;
             }
         else
             {
@@ -459,7 +459,7 @@ void wx_table_generator::compute_column_widths()
 
                     if(0 < underflow)
                         {
-                        i.col_width_++;
+                        ++i.col_width_;
                         underflow--;
                         }
                     }
diff --git a/wx_test_calculation_summary.cpp b/wx_test_calculation_summary.cpp
index 9447fcd..89616fc 100644
--- a/wx_test_calculation_summary.cpp
+++ b/wx_test_calculation_summary.cpp
@@ -208,7 +208,7 @@ void check_calculation_summary_columns
     pos = html.find("\n<td", pos);
     LMI_ASSERT(pos != wxString::npos);
 
-    pos++;                                          // skip the new line
+    ++pos;                                          // skip the new line
 
     // We have found the place where the columns are described in the HTML,
     // iterate over all of them.
@@ -219,7 +219,7 @@ void check_calculation_summary_columns
         pos = html.find(">", pos);                  // end of the <td> tag
         LMI_ASSERT(pos != wxString::npos);
 
-        pos++;                                      // <td> tag contents
+        ++pos;                                      // <td> tag contents
 
         size_t const next = html.find("\n", pos);   // the next line start
         LMI_ASSERT(next != wxString::npos);
diff --git a/wx_test_date.hpp b/wx_test_date.hpp
index 847c9e3..e0feebf 100644
--- a/wx_test_date.hpp
+++ b/wx_test_date.hpp
@@ -50,11 +50,11 @@ calendar_date get_first_next_month(calendar_date const& 
date)
     if(month == 12)
         {
         month = 1;
-        year++;
+        ++year;
         }
     else
         {
-        month++;
+        ++month;
         }
 
     return calendar_date(year, month, 1);



reply via email to

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