[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 14575f1 06/10: Favor designated initializers
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 14575f1 06/10: Favor designated initializers |
Date: |
Sun, 18 Apr 2021 18:21:03 -0400 (EDT) |
branch: master
commit 14575f144cf32193cb90e0084f0f3baea4e72c9c
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Favor designated initializers
The next commit will rearrange the order of gpt_scalar_parms members.
What would happen if this unit test were not correspondingly changed?
Without the present commit, it would compile successfully; it would
fail at run time:
Assertion 'a_SpecAmt <= a_BftAmt' failed.
but only because lmi has so many assertions, one of which happens to
fire (although it's in code that will soon be replaced). With the
present commit, it would fail at compile time:
designator order for field [...] does not match declaration order
as is much to be preferred.
---
gpt_cf_triad_test.cpp | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/gpt_cf_triad_test.cpp b/gpt_cf_triad_test.cpp
index dc20209..3662896 100644
--- a/gpt_cf_triad_test.cpp
+++ b/gpt_cf_triad_test.cpp
@@ -287,17 +287,17 @@ void gpt_cf_triad_test::initialize(int issue_age)
gpt_vector_parms gpt_cf_triad_test::v_parms()
{
gpt_vector_parms z =
- {prem_load_target
- ,prem_load_excess
- ,policy_fee_monthly
- ,policy_fee_annual
- ,specamt_load_monthly
- ,qab_gio_rate
- ,qab_adb_rate
- ,qab_term_rate
- ,qab_spouse_rate
- ,qab_child_rate
- ,qab_waiver_rate
+ {.prem_load_target = prem_load_target
+ ,.prem_load_excess = prem_load_excess
+ ,.policy_fee_monthly = policy_fee_monthly
+ ,.policy_fee_annual = policy_fee_annual
+ ,.specamt_load_monthly = specamt_load_monthly
+ ,.qab_gio_rate = qab_gio_rate
+ ,.qab_adb_rate = qab_adb_rate
+ ,.qab_term_rate = qab_term_rate
+ ,.qab_spouse_rate = qab_spouse_rate
+ ,.qab_child_rate = qab_child_rate
+ ,.qab_waiver_rate = qab_waiver_rate
};
return z;
}
@@ -307,17 +307,17 @@ gpt_vector_parms gpt_cf_triad_test::v_parms()
gpt_scalar_parms gpt_cf_triad_test::s_parms()
{
gpt_scalar_parms z =
- { 0 // duration
- , 1000.0 // target
- ,120000.0 // f3bft
- ,100000.0 // endt_bft
- ,100000.0 // chg_sa_amt
- , 20000.0 // qab_gio_amt
- ,100000.0 // qab_adb_amt
- , 25000.0 // qab_term_amt
- , 10000.0 // qab_spouse_amt
- , 5000.0 // qab_child_amt
- , 50000.0 // qab_waiver_amt
+ {.duration = 0
+ ,.target = 1000.0
+ ,.f3bft = 120000.0
+ ,.endt_bft = 100000.0
+ ,.chg_sa_amt = 100000.0
+ ,.qab_gio_amt = 20000.0
+ ,.qab_adb_amt = 100000.0
+ ,.qab_term_amt = 25000.0
+ ,.qab_spouse_amt = 10000.0
+ ,.qab_child_amt = 5000.0
+ ,.qab_waiver_amt = 50000.0
};
return z;
}
- [lmi-commits] [lmi] master updated (191757a -> 8be683c), Greg Chicares, 2021/04/18
- [lmi-commits] [lmi] master 947c1d1 01/10: Upgrade gcc-{8, 9} dialect from c++17 to c++2a, Greg Chicares, 2021/04/18
- [lmi-commits] [lmi] master 325848d 07/10: Change order of struct members, Greg Chicares, 2021/04/18
- [lmi-commits] [lmi] master 14575f1 06/10: Favor designated initializers,
Greg Chicares <=
- [lmi-commits] [lmi] master b2d963e 08/10: Rename some struct members, Greg Chicares, 2021/04/18
- [lmi-commits] [lmi] master 1a941f1 05/10: Add an inchoate GPT reimplementation, Greg Chicares, 2021/04/18
- [lmi-commits] [lmi] master 34b010b 02/10: Rename a unit test, Greg Chicares, 2021/04/18
- [lmi-commits] [lmi] master 3e46bba 03/10: Rename a unit-test class, Greg Chicares, 2021/04/18
- [lmi-commits] [lmi] master 8be683c 10/10: Record speed measurements, Greg Chicares, 2021/04/18
- [lmi-commits] [lmi] master 10299f3 09/10: Augment a parameter object, Greg Chicares, 2021/04/18
- [lmi-commits] [lmi] master 1665c7a 04/10: Follow the rule of zero, Greg Chicares, 2021/04/18