Skip to content

Commit c7ea8d3

Browse files
Add sizeof(size_t) assumptions
1 parent 2d46f1b commit c7ea8d3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/compat/assumptions.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ static_assert(sizeof(double) == 8, "64-bit double assumed");
4040
static_assert(sizeof(short) == 2, "16-bit short assumed");
4141
static_assert(sizeof(int) == 4, "32-bit int assumed");
4242

43+
// Assumption: We assume size_t to be 32-bit or 64-bit.
44+
// Example(s): size_t assumed to be at least 32-bit in ecdsa_signature_parse_der_lax(...).
45+
// size_t assumed to be 32-bit or 64-bit in MallocUsage(...).
46+
static_assert(sizeof(size_t) == 4 || sizeof(size_t) == 8, "size_t assumed to be 32-bit or 64-bit");
47+
static_assert(sizeof(size_t) == sizeof(void*), "Sizes of size_t and void* assumed to be equal");
48+
4349
// Some important things we are NOT assuming (non-exhaustive list):
44-
// * We are NOT assuming a specific value for sizeof(std::size_t).
4550
// * We are NOT assuming a specific value for std::endian::native.
4651
// * We are NOT assuming a specific value for std::locale("").name().
4752
// * We are NOT assuming a specific value for std::numeric_limits<char>::is_signed.

0 commit comments

Comments
 (0)