lmi-commits
[Top][All Lists]
Advanced

[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;
 }



reply via email to

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