[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);
}
}
- [lmi-commits] [lmi] master updated (ee23febb -> fd6587af), Greg Chicares, 2022/06/26
- [lmi-commits] [lmi] master 41fce79a 08/10: Test with clang as well as gcc, Greg Chicares, 2022/06/26
- [lmi-commits] [lmi] master 9eae460d 06/10: Support clang, Greg Chicares, 2022/06/26
- [lmi-commits] [lmi] master d0b24945 04/10: Add a useful command, Greg Chicares, 2022/06/26
- [lmi-commits] [lmi] master fd6587af 10/10: Import improved commentary, Greg Chicares, 2022/06/26
- [lmi-commits] [lmi] master 606e9355 01/10: Permit clang version macros, Greg Chicares, 2022/06/26
- [lmi-commits] [lmi] master 5175f188 02/10: Don't use 'volatile' in a context where it is deprecated,
Greg Chicares <=
- [lmi-commits] [lmi] master 815897a8 09/10: Remove an obsolete comment, Greg Chicares, 2022/06/26
- [lmi-commits] [lmi] master 3db28e83 07/10: Make clang '-ffp' flags work without crashing, Greg Chicares, 2022/06/26
- [lmi-commits] [lmi] master 95add508 05/10: Forestall a clang complaint, Greg Chicares, 2022/06/26
- [lmi-commits] [lmi] master 3e9c5f3f 03/10: Remove disused 'platform_cgicc_libraries', Greg Chicares, 2022/06/26