Document that you shouldn't Q_ENUM() things outside the int range
The meta object system stores enums as signed int, probably for performance reasons. This is good enough for about 99% of the use cases. If you try to register larger types and then access them through the metaobject system, you can get undefined behavior. Task-number: QTBUG-71947 Change-Id: I16b395547c22fad10b476c2c2a0768538db0a20e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
parent
730f0df17d
commit
4faf011c3f
|
|
@ -4338,6 +4338,12 @@ QDebug operator<<(QDebug dbg, const QObject *o)
|
|||
in a QVariant, you can convert them to strings. Likewise, passing them to
|
||||
QDebug will print out their names.
|
||||
|
||||
Mind that the enum values are stored as signed \c int in the meta object system.
|
||||
Registering enumerations with values outside the range of values valid for \c int
|
||||
will lead to overflows and potentially undefined behavior when accessing them through
|
||||
the meta object system. QML, for example, does access registered enumerations through
|
||||
the meta object system.
|
||||
|
||||
\sa {Qt's Property System}
|
||||
*/
|
||||
|
||||
|
|
@ -4389,6 +4395,12 @@ QDebug operator<<(QDebug dbg, const QObject *o)
|
|||
used in a QVariant, you can convert them to strings. Likewise, passing them
|
||||
to QDebug will print out their names.
|
||||
|
||||
Mind that the enum values are stored as signed \c int in the meta object system.
|
||||
Registering enumerations with values outside the range of values valid for \c int
|
||||
will lead to overflows and potentially undefined behavior when accessing them through
|
||||
the meta object system. QML, for example, does access registered enumerations through
|
||||
the meta object system.
|
||||
|
||||
\sa {Qt's Property System}
|
||||
*/
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue