Changeset View
Changeset View
Standalone View
Standalone View
src/compat/assumptions.h
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
// char, unsigned char, and std::byte (C++17) are the only "byte types" | // char, unsigned char, and std::byte (C++17) are the only "byte types" | ||||
// according to the C++ Standard. "byte type" means a type that can be used to | // according to the C++ Standard. "byte type" means a type that can be used to | ||||
// observe an object's value representation. We use uint8_t everywhere to see | // observe an object's value representation. We use uint8_t everywhere to see | ||||
// bytes, so we have to ensure that uint8_t is an alias to a "byte type". | // bytes, so we have to ensure that uint8_t is an alias to a "byte type". | ||||
// http://eel.is/c++draft/basic.types | // http://eel.is/c++draft/basic.types | ||||
// http://eel.is/c++draft/basic.memobj#def:byte | // http://eel.is/c++draft/basic.memobj#def:byte | ||||
// http://eel.is/c++draft/expr.sizeof#1 | // http://eel.is/c++draft/expr.sizeof#1 | ||||
// http://eel.is/c++draft/cstdint#syn | // http://eel.is/c++draft/cstdint#syn | ||||
static_assert(std::is_same<uint8_t, unsigned char>::value); | static_assert(std::is_same<uint8_t, unsigned char>::value, | ||||
"uint8_t is an alias of unsigned char"); | |||||
// Some important things we are NOT assuming (non-exhaustive list): | // Some important things we are NOT assuming (non-exhaustive list): | ||||
// * We are NOT assuming a specific value for sizeof(std::size_t). | // * We are NOT assuming a specific value for sizeof(std::size_t). | ||||
// * We are NOT assuming a specific value for std::endian::native. | // * We are NOT assuming a specific value for std::endian::native. | ||||
// * We are NOT assuming a specific value for std::locale("").name(). | // * We are NOT assuming a specific value for std::locale("").name(). | ||||
// * We are NOT assuming a specific value for | // * We are NOT assuming a specific value for | ||||
// std::numeric_limits<char>::is_signed. | // std::numeric_limits<char>::is_signed. | ||||
#endif // BITCOIN_COMPAT_ASSUMPTIONS_H | #endif // BITCOIN_COMPAT_ASSUMPTIONS_H |