Ensure a consistent definition of TimingSegment::EPSILON
Since the EPSILON variable in the header file was declared but not assigned any value, it could lead to undefined behavior or calculation errors when the variable is used without initialization. This ensures a consistent value is always used and is also defined at compile time for further safety.
This commit is contained in:
@@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
const double TimingSegment::EPSILON = 1e-6;
|
|
||||||
|
|
||||||
static const char *TimingSegmentTypeNames[] = {
|
static const char *TimingSegmentTypeNames[] = {
|
||||||
"BPM",
|
"BPM",
|
||||||
"Stop",
|
"Stop",
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ struct TimingSegment
|
|||||||
m_iStartRow( other.GetRow() ) { }
|
m_iStartRow( other.GetRow() ) { }
|
||||||
|
|
||||||
// for our purposes, two floats within this level of error are equal
|
// for our purposes, two floats within this level of error are equal
|
||||||
static const double EPSILON;
|
static constexpr double EPSILON = 1e-6;
|
||||||
|
|
||||||
virtual ~TimingSegment() { }
|
virtual ~TimingSegment() { }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user