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>
This commit is contained in:
parent
650b436635
commit
b8b75cdcfa
@ -3971,8 +3971,9 @@ bool qunsetenv(const char *varName)
|
|||||||
\list
|
\list
|
||||||
\li \c Q_PRIMITIVE_TYPE specifies that \a Type is a POD (plain old
|
\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
|
data) type with no constructor or destructor, or else a type where
|
||||||
every bit pattern is a valid object and memcpy() creates a valid
|
every bit pattern is a valid object; memset()ting memory to zero
|
||||||
independent copy of the object.
|
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
|
\li \c Q_RELOCATABLE_TYPE specifies that \a Type has a constructor
|
||||||
and/or a destructor but can be moved in memory using \c
|
and/or a destructor but can be moved in memory using \c
|
||||||
memcpy().
|
memcpy().
|
||||||
|
Loading…
x
Reference in New Issue
Block a user