path: root/src/corelib/tools/qdatetime.h
diff options
authorThiago Macieira <>2014-11-19 11:12:32 -0800
committerThiago Macieira <>2014-11-21 20:37:39 +0100
commitdef272750cdb7810bca4f4815ed1183ba2bd6df9 (patch)
tree0f6cc66310071359aa2380c6cbb5a43f45be1026 /src/corelib/tools/qdatetime.h
parent9bb64bff6139b63e271dca53f1be34b277436b65 (diff)
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 <>
Diffstat (limited to 'src/corelib/tools/qdatetime.h')
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index c5e64d7d52..a75d7d9bc8 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -111,7 +111,8 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d)
inline qint64 toJulianDay() const { return jd; }
- 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); }