Difference between revisions of "cpp/freestanding"
From cppreference.com
< cpp
(→Requirements on standard library headers: update) |
|||
Line 41: | Line 41: | ||
|- | |- | ||
| Type identification || {{header|typeinfo}} | | Type identification || {{header|typeinfo}} | ||
+ | |- | ||
+ | | Source location || {{header|source_location}} {{mark since c++20}} | ||
|- | |- | ||
| Exception handling || {{header|exception}} | | Exception handling || {{header|exception}} | ||
|- | |- | ||
| Initializer lists || {{header|initializer_list}} {{mark since c++11}} | | Initializer lists || {{header|initializer_list}} {{mark since c++11}} | ||
+ | |- | ||
+ | | Comparisons || {{header|compare}} {{mark since c++20}} | ||
+ | |- | ||
+ | | Coroutines support || {{header|coroutine}} {{mark since c++20}} | ||
|- | |- | ||
| Other runtime support || {{header|cstdarg}} | | Other runtime support || {{header|cstdarg}} | ||
Line 51: | Line 57: | ||
|- | |- | ||
| Type traits || {{header|type_traits}} {{mark since c++11}} | | Type traits || {{header|type_traits}} {{mark since c++11}} | ||
− | |||
− | |||
|- | |- | ||
| Bit manipulation || {{header|bit}} {{mark since c++20}} | | Bit manipulation || {{header|bit}} {{mark since c++20}} | ||
+ | |- | ||
+ | | Atomics || {{header|atomic}} {{mark since c++11}}<ref>{{rev inl|since=c++20|Support for always lock-free integral atomic types and presence of type aliases {{lc|std::atomic_signed_lock_free}} and {{lc|std::atomic_unsigned_lock_free}} are implementation-defined.}}</ref> | ||
|- | |- | ||
| || {{header|ciso646}} {{mark life|since=c++11|until=c++20}} | | || {{header|ciso646}} {{mark life|since=c++11|until=c++20}} |
Revision as of 20:21, 2 December 2019
There are two kinds of implementations defined by the C++ standard: hosted and freestanding implementations. For hosted implementations the set of standard library headers required by the C++ standard is much larger than for freestanding ones. In a freestanding implementation execution may happen without an operating system.
Requirements on multi-threaded executions and data races
|
(since C++11) |
Requirements on the main function
freestanding | hosted |
---|---|
In a freestanding implementation, it is implementation-defined whether a program is required to define a main function. Start-up and termination is implementation-defined; start-up contains the execution of constructors for objects of namespace scope with static storage duration; termination contains the execution of destructors for objects with static storage duration. | In a hosted implementation, a program must contain a global function called main. Executing a program starts a main thread of execution in which the main function is invoked, and in which variables of static storage duration might be initialized and destroyed.
|
Requirements on standard library headers
A freestanding implementation has an implementation-defined set of headers. This set includes at least the headers in the following table:
Types | <cstddef> |
Implementation properties | <limits> <cfloat> <climits> (since C++11) <version> (since C++20) |
Integer types | <cstdint> (since C++11) |
Start and termination | <cstdlib> (partial)[1] |
Dynamic memory management | <new> |
Type identification | <typeinfo> |
Source location | <source_location> (since C++20) |
Exception handling | <exception> |
Initializer lists | <initializer_list> (since C++11) |
Comparisons | <compare> (since C++20) |
Coroutines support | <coroutine> (since C++20) |
Other runtime support | <cstdarg> |
Fundamental library concepts | <concepts> (since C++20) |
Type traits | <type_traits> (since C++11) |
Bit manipulation | <bit> (since C++20) |
Atomics | <atomic> (since C++11)[2] |
<ciso646> (since C++11)(until C++20) | |
Deprecated headers | <cstdalign> <cstdbool> (since C++11)(until C++20) |
- ↑ The supplied version of the header
<cstdlib>
shall declare at least the functions std::abort, std::atexit, std::exit, std::at_quick_exit and std::quick_exit(since C++11). - ↑ Support for always lock-free integral atomic types and presence of type aliases std::atomic_signed_lock_free and std::atomic_unsigned_lock_free are implementation-defined.(since C++20)
References
- C++17 standard (ISO/IEC 14882:2017):
- 4.1 Implementation compliance (p: 5)
- 4.7 Multi-threaded executions and data races (p: 15)
- 6.6.1 Main function (p: 66)
- 20.5.1.3 Freestanding implementations (p: 458)
- C++14 standard (ISO/IEC 14882:2014):
- 1.4 Implementation compliance (p: 5)
- 1.10 Multi-threaded executions and data races (p: 11)
- 3.6.1 Main function (p: 62)
- 17.6.1.3 Freestanding implementations (p: 441)
- C++11 standard (ISO/IEC 14882:2011):
- 1.4 Implementation compliance (p: 5)
- 1.10 Multi-threaded executions and data races (p: 11)
- 3.6.1 Main function (p: 58)
- 17.6.1.3 Freestanding implementations (p: 408)
- C++03 standard (ISO/IEC 14882:2003):
- 1.4 Implementation compliance (p: 3)
- 3.6.1 Main function (p: 43)
- 17.4.1.3 Freestanding implementations (p: 326)
See also
C documentation for Conformance
|