From ccb7eff4ec857d83a09981c77cdac341195d0978 Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Thu, 11 Mar 2021 11:07:31 -0800 Subject: [PATCH] CP.1: Made "bad" example consistent with now-updated "good" example --- CppCoreGuidelines.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index b76d5e8..3d9b57c 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -1,6 +1,6 @@ # C++ Core Guidelines -January 28, 2021 +March 11, 2021 Editors: @@ -13927,10 +13927,10 @@ However, over time, code fragments can turn up in unexpected places. ##### Example, bad - double cached_computation(double x) + double cached_computation(int x) { // bad: these statics cause data races in multi-threaded usage - static double cached_x = 0.0; + static int cached_x = 0.0; static double cached_result = COMPUTATION_OF_ZERO; if (cached_x != x) {