QGlobal: static_assert that sizeof(int) == 4 and UCHAR_MAX == 255
According to Thiago, Qt assumes this in a lot of places, so make it explicit. Change-Id: I3f4a55699379fd9fe4d792061c80b3b589c10c53 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
6381c807e5
commit
6d45bf683e
|
|
@ -88,6 +88,14 @@ Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n);
|
|||
Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
|
||||
#endif
|
||||
|
||||
// Statically check assumptions about the environment we're running
|
||||
// in. The idea here is to error or warn if otherwise implicit Qt
|
||||
// assumptions are not fulfilled on new hardware or compilers
|
||||
// (if this list becomes too long, consider factoring into a separate file)
|
||||
Q_STATIC_ASSERT_X(sizeof(int) == 4, "Qt assumes that int is 32 bits");
|
||||
Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits");
|
||||
|
||||
|
||||
/*!
|
||||
\class QFlag
|
||||
\inmodule QtCore
|
||||
|
|
|
|||
Loading…
Reference in New Issue