lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 5175f188 02/10: Don't use 'volatile' in a con


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 5175f188 02/10: Don't use 'volatile' in a context where it is deprecated
Date: Sun, 26 Jun 2022 17:47:47 -0400 (EDT)

branch: master
commit 5175f1889f8c78ddf98549dc696e8019aa625c4c
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Don't use 'volatile' in a context where it is deprecated
    
    The original code involved a deprecated usage of 'volatile' according
    to clang. Replaced it with a non-deprecated usage that is actually
    better, because it performs a volatile write at the last stage of the
    calculation that's being timed.
---
 commutation_functions_test.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/commutation_functions_test.cpp b/commutation_functions_test.cpp
index 71d0464a..79f06bef 100644
--- a/commutation_functions_test.cpp
+++ b/commutation_functions_test.cpp
@@ -26,6 +26,7 @@
 #include "cso_table.hpp"
 #include "et_vector.hpp"
 #include "math_functions.hpp"
+#include "miscellany.hpp"               // stifle_unused_warning()
 #include "ssize_lmi.hpp"
 #include "test_tools.hpp"
 #include "timer.hpp"                    // TimeAnAliquot()
@@ -828,9 +829,11 @@ void mete_reserve
 {
     for(int j = 0; j < 100; ++j)
         {
-        volatile double premium = (10.0 * ulcf.aDomega() + ulcf.kM()[0]) / 
ulcf.aN()[0];
+        double premium = (10.0 * ulcf.aDomega() + ulcf.kM()[0]) / ulcf.aN()[0];
         reserve <<= premium * ulcf.aD() - ulcf.kC();
         reserve <<= fwd_sum(reserve) / ulcf.EaD();
+        volatile double last = reserve.back();
+        stifle_unused_warning(last);
         }
 }
 



reply via email to

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