From 8c29cab2613edbeee5c5f05d9b21034936687c9b Mon Sep 17 00:00:00 2001 From: attila Date: Tue, 24 Oct 2023 15:28:21 +0200 Subject: [PATCH] CachedValue: Stop suppressing floating point comparison warnings --- BREAKING_CHANGES.md | 26 +++++++++++++++++++ .../values/juce_CachedValue.h | 2 -- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 0c852fe714..14b9ae7bf4 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -1,5 +1,31 @@ # JUCE breaking changes +## Change + +CachedValue::operator==() will now emit floating point comparison warnings if +they are enabled for the project. + +**Possible Issues** + +Code using this function to compare floating point values may fail to compile +due to the warnings. + +**Workaround** + +Rather than using CachedValue::operator==() for floating point types, use the +exactlyEqual() or approximatelyEqual() functions in combination with +CachedValue::get(). + +**Rationale** + +The JUCE Framework now offers the free-standing exactlyEqual() and +approximatelyEqual() functions to clearly express the desired semantics when +comparing floating point values. These functions are intended to eliminate +the ambiguity in code-bases regarding these types. However, when such a value +is wrapped in a CachedValue the corresponding warning was suppressed until now, +making such efforts incomplete. + + # Version 7.0.8 ## Change diff --git a/modules/juce_data_structures/values/juce_CachedValue.h b/modules/juce_data_structures/values/juce_CachedValue.h index 11f870b905..cb3693d8de 100644 --- a/modules/juce_data_structures/values/juce_CachedValue.h +++ b/modules/juce_data_structures/values/juce_CachedValue.h @@ -118,9 +118,7 @@ public: template bool operator== (const OtherType& other) const { - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wfloat-equal") return cachedValue == other; - JUCE_END_IGNORE_WARNINGS_GCC_LIKE } /** Returns true if the current value of the property (or the fallback value)