Put parentheses around "min" to prevent expansion as macro

If you write xxxx::min(), min() might be expanded as a macro on silly
environments that follow that poor practice (read: inclusion of
<windows.h> without NOMINMAX). However, if you write (min)() or
(xxx::min)(), it means the same but prevents the expansion as macro.

Task-number: QTBUG-42767
Task-number: QTBUG-31469
Change-Id: If3c93aafd4d0bf63ca15f3d01c2297d58d00f6bc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Thiago Macieira 2014-11-19 11:12:32 -08:00
parent 9bb64bff61
commit def272750c

View File

@ -111,7 +111,8 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d)
inline qint64 toJulianDay() const { return jd; }
private:
static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
// using extra parentheses around min to avoid expanding it if it is a macro
static inline qint64 nullJd() { return (std::numeric_limits<qint64>::min)(); }
static inline qint64 minJd() { return Q_INT64_C(-784350574879); }
static inline qint64 maxJd() { return Q_INT64_C( 784354017364); }