[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 3952bd0 08/10: Remove undesirable 'default:'
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 3952bd0 08/10: Remove undesirable 'default:' from 'switch' |
Date: |
Thu, 8 Feb 2018 08:40:10 -0500 (EST) |
branch: master
commit 3952bd064c15b0b17127cf45341e5b7575cc8dbb
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Remove undesirable 'default:' from 'switch'
These are simple changes that only delete 'default' cases and move
"unreachable" throw-statements as necessary.
---
basicvalues.cpp | 18 ----------
ihs_avmly.cpp | 94 +------------------------------------------------
ihs_avstrtgy.cpp | 17 ++-------
ihs_basicval.cpp | 63 ---------------------------------
ihs_irc7702a.cpp | 9 -----
ihs_mortal.cpp | 5 ---
input_harmonization.cpp | 27 --------------
mc_enum_types_aux.cpp | 1 -
mortality_rates.cpp | 1 -
pdf_writer_wx.cpp | 8 -----
progress_meter_cli.cpp | 4 ---
stratified_charges.cpp | 8 -----
12 files changed, 3 insertions(+), 252 deletions(-)
diff --git a/basicvalues.cpp b/basicvalues.cpp
index e844e37..a8936b3 100644
--- a/basicvalues.cpp
+++ b/basicvalues.cpp
@@ -191,15 +191,6 @@ double BasicValues::GetModalTgtPrem
spread = 0.0000;
}
break;
- default:
- {
- alarum()
- << "Case "
- << a_mode
- << " not found."
- << LMI_FLUSH
- ;
- }
}
double u = 1.0 + std::max
@@ -275,15 +266,6 @@ double BasicValues::GetModalTgtSpecAmt
spread = 0.0000;
}
break;
- default:
- {
- alarum()
- << "Case "
- << a_mode
- << " not found."
- << LMI_FLUSH
- ;
- }
}
double u = 1.0 + std::max
diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index fc859d2..25801f7 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -301,15 +301,6 @@ void AccountValue::process_payment(double payment)
IncrementAVPreferentially(ee_net_pmt,
ee_premium_preferred_account);
}
break;
- default:
- {
- alarum()
- << "Case '"
- << ee_premium_allocation_method
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
switch(er_premium_allocation_method)
{
@@ -323,15 +314,6 @@ void AccountValue::process_payment(double payment)
IncrementAVPreferentially(er_net_pmt,
er_premium_preferred_account);
}
break;
- default:
- {
- alarum()
- << "Case '"
- << er_premium_allocation_method
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
// TODO ?? Perhaps now we should transfer funds from the separate
@@ -366,15 +348,6 @@ void AccountValue::IncrementAVPreferentially
AVSepAcct += increment;
}
break;
- default:
- {
- alarum()
- << "Case '"
- << preferred_account
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
}
@@ -395,15 +368,6 @@ void AccountValue::process_deduction(double decrement)
DecrementAVProgressively(decrement, deduction_preferred_account);
}
break;
- default:
- {
- alarum()
- << "Case '"
- << deduction_method
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
}
@@ -423,15 +387,6 @@ void AccountValue::process_distribution(double decrement)
DecrementAVProgressively(decrement,
distribution_preferred_account);
}
break;
- default:
- {
- alarum()
- << "Case '"
- << distribution_method
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
}
@@ -528,15 +483,6 @@ void AccountValue::DecrementAVProgressively
AVGenAcct -= progressively_reduce(AVSepAcct, AVGenAcct, decrement);
}
break;
- default:
- {
- alarum()
- << "Case '"
- << preferred_account
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
}
@@ -762,15 +708,6 @@ void AccountValue::ChangeSpecAmtBy(double delta)
ProportionAppliedToTerm = 0.0;
}
break;
- default:
- {
- alarum()
- << "Case "
- << yare_input_.TermAdjustmentMethod
- << " not found."
- << LMI_FLUSH
- ;
- }
}
ActualSpecAmt += delta * (1.0 - ProportionAppliedToTerm);
@@ -999,10 +936,6 @@ void AccountValue::TxOptionChange()
// Do nothing.
}
break;
- default:
- {
- alarum() << "Case " << YearsDBOpt << " not found." << LMI_FLUSH;
- }
}
}
@@ -1672,10 +1605,6 @@ void AccountValue::TxSetDeathBft(bool force_eoy_behavior)
DB7702A = ActualSpecAmt + std::max(0.0, CumPmts);
}
break;
- default:
- {
- alarum() << "Case " << YearsDBOpt << " not found." << LMI_FLUSH;
- }
}
// Surrender charges are generally ignored here, but any negative
@@ -1945,15 +1874,6 @@ void AccountValue::TxSetRiderDed()
);
}
break;
- default:
- {
- alarum()
- << "Case '"
- << WaiverChargeMethod
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
}
}
@@ -2126,10 +2046,6 @@ void AccountValue::ApplyDynamicMandE(double assets)
;
}
break;
- default:
- {
- alarum() << "Case " << GenBasis_ << " not found." << LMI_FLUSH;
- }
}
// TODO ?? Implement tiered comp and tiered management fee.
@@ -2352,12 +2268,8 @@ double AccountValue::anticipated_deduction
{
return MlyDed * (1 + MonthsToNextModalPmtDate());
}
- default:
- {
- alarum() << "Case " << method << " not found." << LMI_FLUSH;
- throw "Unreachable--silences a compiler diagnostic.";
- }
}
+ throw "Unreachable--silences a compiler diagnostic.";
}
/// Calculate maximum permissible withdrawal.
@@ -2654,10 +2566,6 @@ void AccountValue::TxTakeWD()
}
}
break;
- default:
- {
- alarum() << "Case " << YearsDBOpt << " not found." << LMI_FLUSH;
- }
}
CumPmts -= NetWD;
diff --git a/ihs_avstrtgy.cpp b/ihs_avstrtgy.cpp
index 19c8646..e6b20ac 100644
--- a/ihs_avstrtgy.cpp
+++ b/ihs_avstrtgy.cpp
@@ -102,12 +102,8 @@ double AccountValue::CalculateSpecAmtFromStrategy
{
return GetModalSpecAmtSalary (actual_year);
}
- default:
- {
- alarum() << "Case " << strategy << " not found." << LMI_FLUSH;
- throw "Unreachable--silences a compiler diagnostic.";
- }
}
+ throw "Unreachable--silences a compiler diagnostic.";
}
/// Set specamt according to selected strategy, respecting minimum.
@@ -310,17 +306,8 @@ double AccountValue::DoPerformPmtStrategy
/ a_CurrentMode
;
}
- default:
- {
- alarum()
- << "Case "
- << a_StrategyVector[Year]
- << " not found."
- << LMI_FLUSH
- ;
- throw "Unreachable--silences a compiler diagnostic.";
- }
}
+ throw "Unreachable--silences a compiler diagnostic.";
}
/// Set employee payment according to selected strategy.
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index e8614e0..9e47e47 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -508,15 +508,6 @@ void BasicValues::Init7702()
// do nothing
}
break;
- default:
- {
- alarum()
- << "Case "
- << yare_input_.LoanRateType
- << " not found."
- << LMI_FLUSH
- ;
- }
}
*/
@@ -853,15 +844,6 @@ void BasicValues::SetMaxSurvivalDur()
MaxSurvivalDur = std::accumulate(z.begin(), z.end(), 0.0);
}
break;
- default:
- {
- alarum()
- << "Case "
- << yare_input_.SurviveToType
- << " not found."
- << LMI_FLUSH
- ;
- }
}
LMI_ASSERT(MaxSurvivalDur <= EndtAge);
}
@@ -1167,15 +1149,6 @@ std::pair<double,double> BasicValues::approx_mly_ded
ann_ded *= 1.0 + r;
}
break;
- default:
- {
- alarum()
- << "Case '"
- << WaiverChargeMethod
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
}
@@ -1268,15 +1241,6 @@ std::pair<double,double> BasicValues::approx_mly_ded_ex
er_ded *= 1.0 + r;
}
break;
- default:
- {
- alarum()
- << "Case '"
- << WaiverChargeMethod
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
}
@@ -1683,15 +1647,6 @@ std::vector<double> BasicValues::GetTable
BlendSmoking = true;
}
break;
- default:
- {
- alarum()
- << "Case '"
- << CanBlendSmoking
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
bool BlendGender = false;
@@ -1712,15 +1667,6 @@ std::vector<double> BasicValues::GetTable
BlendGender = true;
}
break;
- default:
- {
- alarum()
- << "Case '"
- << CanBlendGender
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
// Case 1: blending is not allowed or not requested--return unblended table
@@ -1897,15 +1843,6 @@ std::vector<double> const&
BasicValues::GetCorridorFactor() const
Non7702CompliantCorridor = std::vector<double>(GetLength(), 1.0);
return Non7702CompliantCorridor;
}
- default:
- {
- alarum()
- << "Case "
- << yare_input_.DefinitionOfLifeInsurance
- << " not found."
- << LMI_FLUSH
- ;
- }
}
throw "Unreachable--silences a compiler diagnostic.";
}
diff --git a/ihs_irc7702a.cpp b/ihs_irc7702a.cpp
index dc0acb6..ecb66c1 100644
--- a/ihs_irc7702a.cpp
+++ b/ihs_irc7702a.cpp
@@ -150,15 +150,6 @@ Irc7702A::Irc7702A
DBDefn = e_death_benefit_7702A;
}
break;
- default:
- {
- alarum()
- << "Case '"
- << DefnMaterialChange
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
// Make sure the 7pp and NSP factors are all in (0, 1].
diff --git a/ihs_mortal.cpp b/ihs_mortal.cpp
index 4947f07..d8ccd39 100644
--- a/ihs_mortal.cpp
+++ b/ihs_mortal.cpp
@@ -276,7 +276,6 @@ std::vector<double> const&
MortalityRates::MonthlyCoiRatesBand0
case mce_gen_curr: return MonthlyCurrentCoiRatesBand0_;
case mce_gen_mdpt: return MonthlyMidpointCoiRatesBand0_;
case mce_gen_guar: return MonthlyGuaranteedCoiRates_;
- default: alarum() << "Case " << b << " not found." << LMI_FLUSH;
}
throw "Unreachable--silences a compiler diagnostic.";
}
@@ -291,7 +290,6 @@ std::vector<double> const&
MortalityRates::MonthlyCoiRatesBand1
case mce_gen_curr: return MonthlyCurrentCoiRatesBand1_;
case mce_gen_mdpt: return MonthlyMidpointCoiRatesBand1_;
case mce_gen_guar: return MonthlyGuaranteedCoiRates_;
- default: alarum() << "Case " << b << " not found." << LMI_FLUSH;
}
throw "Unreachable--silences a compiler diagnostic.";
}
@@ -306,7 +304,6 @@ std::vector<double> const&
MortalityRates::MonthlyCoiRatesBand2
case mce_gen_curr: return MonthlyCurrentCoiRatesBand2_;
case mce_gen_mdpt: return MonthlyMidpointCoiRatesBand2_;
case mce_gen_guar: return MonthlyGuaranteedCoiRates_;
- default: alarum() << "Case " << b << " not found." << LMI_FLUSH;
}
throw "Unreachable--silences a compiler diagnostic.";
}
@@ -321,7 +318,6 @@ std::vector<double> const& MortalityRates::SpouseRiderRates
case mce_gen_curr: return CurrentSpouseRiderRates_;
case mce_gen_mdpt: return MidpointSpouseRiderRates_;
case mce_gen_guar: return GuaranteedSpouseRiderRates_;
- default: alarum() << "Case " << b << " not found." << LMI_FLUSH;
}
throw "Unreachable--silences a compiler diagnostic.";
}
@@ -336,7 +332,6 @@ std::vector<double> const&
MortalityRates::MonthlyTermCoiRates
case mce_gen_curr: return MonthlyCurrentTermCoiRates_;
case mce_gen_mdpt: return MonthlyMidpointTermCoiRates_;
case mce_gen_guar: return MonthlyGuaranteedTermCoiRates_;
- default: alarum() << "Case " << b << " not found." << LMI_FLUSH;
}
throw "Unreachable--silences a compiler diagnostic.";
}
diff --git a/input_harmonization.cpp b/input_harmonization.cpp
index 48655d4..d9ed6ff 100644
--- a/input_harmonization.cpp
+++ b/input_harmonization.cpp
@@ -985,15 +985,6 @@ void Input::set_solve_durations()
SolveTargetYear = years_to_maturity();
}
break;
- default:
- {
- alarum()
- << "Case '"
- << SolveTgtAtWhich.value()
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
switch(SolveFromWhich.value())
@@ -1018,15 +1009,6 @@ void Input::set_solve_durations()
SolveBeginYear = years_to_retirement();
}
break;
- default:
- {
- alarum()
- << "Case '"
- << SolveFromWhich.value()
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
switch(SolveToWhich.value())
@@ -1051,15 +1033,6 @@ void Input::set_solve_durations()
SolveEndYear = years_to_maturity();
}
break;
- default:
- {
- alarum()
- << "Case '"
- << SolveToWhich.value()
- << "' not found."
- << LMI_FLUSH
- ;
- }
}
// Remove the following three lines (and <algorithm>) after fixing this:
diff --git a/mc_enum_types_aux.cpp b/mc_enum_types_aux.cpp
index bcee35d..44f3660 100644
--- a/mc_enum_types_aux.cpp
+++ b/mc_enum_types_aux.cpp
@@ -99,7 +99,6 @@ mcenum_dbopt_7702 effective_dbopt_7702
case mce_option1: return mce_option1_for_7702;
case mce_option2: return mce_option2_for_7702;
case mce_rop: return rop_equivalent ;
- default: alarum() << "No " << actual_dbopt << " case." << LMI_FLUSH;
}
throw "Unreachable--silences a compiler diagnostic.";
}
diff --git a/mortality_rates.cpp b/mortality_rates.cpp
index 52499c1..921cfe8 100644
--- a/mortality_rates.cpp
+++ b/mortality_rates.cpp
@@ -102,7 +102,6 @@ std::vector<double> const& MortalityRates::MonthlyCoiRates
case mce_gen_curr: return MonthlyCurrentCoiRatesBand0_;
case mce_gen_mdpt: return MonthlyMidpointCoiRatesBand0_;
case mce_gen_guar: return MonthlyGuaranteedCoiRates_;
- default: alarum() << "Case " << b << " not found." << LMI_FLUSH;
}
throw "Unreachable--silences a compiler diagnostic.";
}
diff --git a/pdf_writer_wx.cpp b/pdf_writer_wx.cpp
index b72b51b..b3da776 100644
--- a/pdf_writer_wx.cpp
+++ b/pdf_writer_wx.cpp
@@ -155,10 +155,6 @@ void pdf_writer_wx::output_image
case oe_only_measure:
// Do nothing.
break;
- default:
- {
- alarum() << "Case " << output_mode << " not found." << LMI_FLUSH;
- }
}
*pos_y += y;
@@ -205,10 +201,6 @@ int pdf_writer_wx::output_html
case oe_only_measure:
// Do nothing.
break;
- default:
- {
- alarum() << "Case " << output_mode << " not found." << LMI_FLUSH;
- }
}
return cell->GetHeight();
diff --git a/progress_meter_cli.cpp b/progress_meter_cli.cpp
index c543ddb..415443e 100644
--- a/progress_meter_cli.cpp
+++ b/progress_meter_cli.cpp
@@ -52,10 +52,6 @@ std::streambuf*
select_streambuf(progress_meter::enum_display_mode display_mode)
z = progress_meter_unit_test_stream().rdbuf();
}
break;
- default:
- {
- alarum() << "Case " << display_mode << " not found." << LMI_FLUSH;
- }
}
return z;
}
diff --git a/stratified_charges.cpp b/stratified_charges.cpp
index 9dd3299..383d658 100644
--- a/stratified_charges.cpp
+++ b/stratified_charges.cpp
@@ -288,10 +288,6 @@ double stratified_charges::stratified_sepacct_load
;
}
break;
- default:
- {
- alarum() << "Case '" << basis << "' not found." << LMI_FLUSH;
- }
}
throw "Unreachable--silences a compiler diagnostic.";
}
@@ -360,10 +356,6 @@ double stratified_charges::tiered_m_and_e(mcenum_gen_basis
basis, double assets)
;
}
break;
- default:
- {
- alarum() << "Case '" << basis << "' not found." << LMI_FLUSH;
- }
}
throw "Unreachable--silences a compiler diagnostic.";
}
- [lmi-commits] [lmi] master updated (eafa74e -> 246f754), Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master 9cc3f6b 05/10: Avoid passing an enum by reference, Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master 20e866a 06/10: Simplify an overwrought expression, Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master b0576c8 02/10: Remove undesirable 'default:' from 'switch', Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master e26d308 09/10: Remove undesirable 'default:' from 'switch', Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master 422e64a 03/10: Remove an unimplemented 'case', Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master 92911ca 07/10: Improve documentation, Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master 9797cbc 04/10: Remove undesirable 'default:' from 'switch', Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master 78fd8b8 01/10: Remove undesirable 'default:' from 'switch', Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master 246f754 10/10: In unit tests, reflect removal of undesirable 'default:' from 'switch', Greg Chicares, 2018/02/08
- [lmi-commits] [lmi] master 3952bd0 08/10: Remove undesirable 'default:' from 'switch',
Greg Chicares <=