summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-11-09 18:01:59 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-11-09 23:25:54 +0100
commitb8b75cdcfa71189c7726607be7b66d0ddeaae372 (patch)
treebfa5bfbefd386739c6f2eca303f3e7012d710725 /src/corelib/global/qglobal.cpp
parent650b436635a8723a671862e311ff3484c5ea4666 (diff)
Q_PRIMITIVE_TYPE: improve the documentation
A key piece of information missing from Q_PRIMITIVE_TYPE documentation is that for them value initialization must equal memset()ting with zeroes. A type like QPoint is primitive because `QPoint p;` is initialized to (0, 0), but a type like QSize is movable (and NOT primitive) because `QSize s;` is actually initialized to (-1, -1). Amend the docs. Change-Id: I121684810da46be5d0579c7d3de945149390a32a Pick-to: 5.15 5.12 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r--src/corelib/global/qglobal.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 424b8b3ac4..48eb5b4567 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -3971,8 +3971,9 @@ bool qunsetenv(const char *varName)
\list
\li \c Q_PRIMITIVE_TYPE specifies that \a Type is a POD (plain old
data) type with no constructor or destructor, or else a type where
- every bit pattern is a valid object and memcpy() creates a valid
- independent copy of the object.
+ every bit pattern is a valid object; memset()ting memory to zero
+ creates a value-initialized instance of the type; and memcpy()ing
+ creates a valid independent copy of an object.
\li \c Q_RELOCATABLE_TYPE specifies that \a Type has a constructor
and/or a destructor but can be moved in memory using \c
memcpy().