Ch20.14: Watch: Freestanding C++ — Past, Present, and Future
Watch This to See How We Got Here
This chapter has been about what freestanding C++ cannot do and why. This talk is the history: how the freestanding subset was specified, why it stayed unchanged for two decades while the language grew, how the C++23 work finally shipped a usable list, and where the holes that remain came from. It is by Ben Saks, it is from CppCon 2019, and it is the best one-hour account of the subject.
The Talk
What to listen for, in the order the talk raises it:
- What "freestanding" was supposed to mean. The intent was a C++ you could use for a program with no OS; what the standard delivered was a list of headers that implied one.
-
The
std::addressofkind of hole. Features that need nothing at run time, and still were not on the list (20.12). - The scoring of what is missing. The talk enumerates the headers and explains which ones can be made freestanding and which cannot, which is the table in 20.6.
-
Why containers will never make it.
vector's interface is a heap and an exception; no wording change fixes that (20.7).
After the Video
Come back with the questions the talk leaves open, because this chapter answers them with measurements the talk could not make in 2019:
-
20.3 — what a legacy
throwactually needs from the linker, and why you cannot supply it. -
20.10 — the error handling that
does work freestanding: one symbol, no unwinder, and
[domain](code)instead of a message table. - 20.13 — a program with zero undefined symbols, which is what "freestanding library" should mean and almost never does.
The next chapter, 21, is about the other place C++'s hosted assumptions cost you: the desktop, where the choice is not between a kernel and a standard library but between a GUI toolkit and a web page.