From ed9540d61367f88a52340aa7ea6c620a9e3cc35b Mon Sep 17 00:00:00 2001 From: Guilherme Janczak Date: Sat, 20 Apr 2024 13:45:12 +0000 Subject: [PATCH] qualify isnan() with std namespace When a program that depends on implot includes , we have this sequence of includes: -> -> -> Inside 's source code, there's an unqualified call to isnan(). By doing so, it relies on having isnan() in the global namespace, which is guaranteed to do. However, it's possible that implot's user included first, which is not guaranteed to put isnan() in the global namespace, and may prevent a later from putting isnan() in the global namespace. On NetBSD 10.0 i386, doesn't put isnan() in the global namespace and prevents from doing so, causing a compile error. Qualify the call to fix it. --- implot_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implot_internal.h b/implot_internal.h index cd05478f..ec3a7400 100644 --- a/implot_internal.h +++ b/implot_internal.h @@ -120,7 +120,7 @@ static inline T ImRemap01(T x, T x0, T x1) { return (x - x0) / (x1 - x0); } // Returns always positive modulo (assumes r != 0) static inline int ImPosMod(int l, int r) { return (l % r + r) % r; } // Returns true if val is NAN -static inline bool ImNan(double val) { return isnan(val); } +static inline bool ImNan(double val) { return std::isnan(val); } // Returns true if val is NAN or INFINITY static inline bool ImNanOrInf(double val) { return !(val >= -DBL_MAX && val <= DBL_MAX) || ImNan(val); } // Turns NANs to 0s