path: root/src/corelib/tools/qdatetime.h
diff options
authorThiago Macieira <>2016-06-22 22:00:08 -0700
committerThiago Macieira <>2016-07-09 02:17:30 +0000
commitcba3378732049a943e044039bde3aab1707ccca1 (patch)
treed61f3519db2689fed4f419b548c9f4c3826cd5b4 /src/corelib/tools/qdatetime.h
parentd16ba63f5cdf1e6c9dc96200bb80b2155437c4ee (diff)
Make QDateTime's default constructor not allocate memory on 32-bit
Commit fb498a651990df5e04c75a9076da28e875c43f73 introduced the short datetime optimization, but it accidentally removed the optimization from Qt 5.7 that made QDateTime's default constructor not allocate memory. Instead of bringing back the Q_GLOBAL_STATIC that was used, let's use the short date time optimization on 32-bit too. The CanBeSmall constant remains false on 32-bit systems, but judicious non-use of that constant in a few functions allows 32-bit systems to use the optimization. We still say that any date/time value is "unsmall", as there's no sense in calculating whether the date is between 1970-01-01 and July 14 of the same year. Change-Id: I413d458307aa46469b80fffd145a9db0325c08cc Reviewed-by: Edward Welbourne <>
Diffstat (limited to 'src/corelib/tools/qdatetime.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index 7111509bcc..ec0eaa1edf 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -230,6 +230,7 @@ class Q_CORE_EXPORT QDateTime
CanBeSmall = sizeof(ShortData) * 8 > 50
+ Data();
Data(const Data &other);
Data(Data &&other);