mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
CachedValue: Stop suppressing floating point comparison warnings
This commit is contained in:
parent
b800890ec6
commit
8c29cab261
2 changed files with 26 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue