Browse Source

CachedValue: Stop suppressing floating point comparison warnings

v7.0.9
attila Attila Szarvas 2 years ago
parent
commit
8c29cab261
2 changed files with 26 additions and 2 deletions
  1. +26
    -0
      BREAKING_CHANGES.md
  2. +0
    -2
      modules/juce_data_structures/values/juce_CachedValue.h

+ 26
- 0
BREAKING_CHANGES.md View File

@@ -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


+ 0
- 2
modules/juce_data_structures/values/juce_CachedValue.h View File

@@ -118,9 +118,7 @@ public:
template <typename OtherType>
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)


Loading…
Cancel
Save