Provide better error if min (or max) is defined in QDateTime

This is better than getting a regular compiler error without
knowing where min was previously defined.

Change-Id: I5a86599cdf76a9a8d87a51e119543206d9f835c1
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Thorbjørn Martsum 2013-01-29 16:22:01 +01:00 committed by The Qt Project
parent 29c80d0232
commit d0804ff2dd

View File

@ -118,6 +118,9 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d)
inline qint64 toJulianDay() const { return jd; }
private:
#if defined(min) || defined(max)
#error min or max defined, cannot continue. If this is caused by an #include of windows.h, NOMINMAX can be defined.
#endif
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); }