Enforce two's complement integers

C++20 will make this true for everyone, but as far as Qt goes,
this has to apply to all platforms even before that.
Just add another couple of checks to the list.

Change-Id: I0251ce431d4584380cfd3fc3e4b36f1dbdbf9df2
Pick-to: 5.15
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Giuseppe D'Angelo 2020-06-03 15:26:15 +02:00
parent 37cfc3c6d2
commit 34ae919f23
1 changed files with 4 additions and 0 deletions

View File

@ -145,6 +145,10 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
Q_STATIC_ASSERT_X(sizeof(float) == 4, "Qt assumes that float is 32 bits");
Q_STATIC_ASSERT_X(sizeof(char16_t) == 2, "Qt assumes that char16_t is 16 bits");
Q_STATIC_ASSERT_X(sizeof(char32_t) == 4, "Qt assumes that char32_t is 32 bits");
Q_STATIC_ASSERT_X(std::numeric_limits<int>::radix == 2,
"Qt assumes binary integers");
Q_STATIC_ASSERT_X((std::numeric_limits<int>::max() + std::numeric_limits<int>::lowest()) == -1,
"Qt assumes two's complement integers");
// While we'd like to check for __STDC_IEC_559__, as per ISO/IEC 9899:2011
// Annex F (C11, normative for C++11), there are a few corner cases regarding