Changeset View
Changeset View
Standalone View
Standalone View
src/compat/assumptions.h
Show All 14 Lines | |||||
// Assumption: We assume that the macro NDEBUG is not defined. | // Assumption: We assume that the macro NDEBUG is not defined. | ||||
// Example(s): We use assert(...) extensively with the assumption of it never | // Example(s): We use assert(...) extensively with the assumption of it never | ||||
// being a noop at runtime. | // being a noop at runtime. | ||||
#if defined(NDEBUG) | #if defined(NDEBUG) | ||||
#error "Bitcoin cannot be compiled without assertions." | #error "Bitcoin cannot be compiled without assertions." | ||||
#endif | #endif | ||||
// Assumption: We assume a C++14 (ISO/IEC 14882:2014) compiler (minimum | // Assumption: We assume a C++17 (ISO/IEC 14882:2017) compiler (minimum | ||||
// requirement). | // requirement). | ||||
// Example(s): We use std::make_unique() through the codebase. | // Example(s): We use std::make_unique() through the codebase. | ||||
// Note: MSVC does not report the expected __cplusplus value due to | // Note: MSVC does not report the expected __cplusplus value due to | ||||
// legacy reasons. | // legacy reasons. | ||||
#if !defined(_MSC_VER) | #if !defined(_MSC_VER) | ||||
// N3936* §16.8 [cpp.predefined]/p1:: | // N3936* §16.8 [cpp.predefined]/p1:: | ||||
// "The name __cplusplus is defined to the value 201402L when compiling a C++ | // "The name __cplusplus is defined to the value 201402L when compiling a C++ | ||||
// translation unit." | // translation unit." | ||||
static_assert(__cplusplus >= 201402L, "C++14 standard assumed"); | static_assert(__cplusplus >= 201703L, "C++17 standard assumed"); | ||||
#endif | #endif | ||||
// Assumption: We assume the floating-point types to fulfill the requirements of | // Assumption: We assume the floating-point types to fulfill the requirements of | ||||
// IEC 559 (IEEE 754) standard. | // IEC 559 (IEEE 754) standard. | ||||
// Example(s): Floating-point division by zero in ConnectBlock, | // Example(s): Floating-point division by zero in ConnectBlock, | ||||
// CreateTransaction | // CreateTransaction | ||||
// and EstimateMedianVal. | // and EstimateMedianVal. | ||||
static_assert(std::numeric_limits<float>::is_iec559, "IEEE 754 float assumed"); | static_assert(std::numeric_limits<float>::is_iec559, "IEEE 754 float assumed"); | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |