diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-11-13 12:33:15 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-11-17 11:47:57 +0100 |
commit | f6f68409a40beaa5f034c411dd7e296c7828d8fd (patch) | |
tree | ee4f470b384269db88f20b5aa5c4947ee05e889c /src/corelib/global/qglobal.cpp | |
parent | 7fc302520b905fc40cc0fa439d3a2e9dbff3e5a6 (diff) |
Don't initialize POD types with memset(0)
This is dangerous as at least pointers to member objects/data
are not always zero initialized.
Change-Id: I1250e101ab73cd816694315fc9130f4d486b9feb
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 48eb5b4567..ad17f41236 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3970,10 +3970,8 @@ 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; memset()ting memory to zero - creates a value-initialized instance of the type; and memcpy()ing - creates a valid independent copy of an object. + data) type with no constructor or destructor, or else a type memcpy()ing + creates a valid independent copy of the 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(). |