From 58bc946e8e3b6eebf46d513a570b6f5b1ffddeef Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Tue, 24 Mar 2020 10:46:18 -0400 Subject: Assert the length of size_t C++11 just says that size_t is at least 16 bits but doesn't make any other specifications. Since we have only tested with 4 or 8, add a static_assert to catch weird platforms. --- src/lib/utils/types.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/utils/types.h b/src/lib/utils/types.h index 7f101735d..5cb48a3f6 100644 --- a/src/lib/utils/types.h +++ b/src/lib/utils/types.h @@ -100,6 +100,13 @@ using s32bit = std::int32_t; #error BOTAN_MP_WORD_BITS must be 32 or 64 #endif +/* +* Should this assert fail on your system please contact the developers +* for assistance in porting. +*/ +static_assert(sizeof(std::size_t) == 8 || sizeof(std::size_t) == 4, + "This platform has an unexpected size for size_t"); + } #endif -- cgit v1.2.3