Skip to content

Commit c7a7250

Browse files
Document assumptions about C++ compiler
1 parent c7ea8d3 commit c7a7250

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/compat/assumptions.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
# error "Bitcoin cannot be compiled without assertions."
1818
#endif
1919

20+
// Assumption: We assume a C++11 (ISO/IEC 14882:2011) compiler (minimum requirement).
21+
// Example(s): We assume the presence of C++11 features everywhere :-)
22+
// Note: MSVC does not report the expected __cplusplus value due to legacy
23+
// reasons.
24+
#if !defined(_MSC_VER)
25+
// ISO Standard C++11 [cpp.predefined]p1:
26+
// "The name __cplusplus is defined to the value 201103L when compiling a C++
27+
// translation unit."
28+
static_assert(__cplusplus >= 201103L, "C++11 standard assumed");
29+
#endif
30+
2031
// Assumption: We assume the floating-point types to fulfill the requirements of
2132
// IEC 559 (IEEE 754) standard.
2233
// Example(s): Floating-point division by zero in ConnectBlock, CreateTransaction

0 commit comments

Comments
 (0)