Good to know what “freestanding” and “hosted” standard library mean in C++:

“Freestanding Standard Library”, Sandor Dargo (https://www.sandordargo.com/blog/2026/04/08/cpp-freestanding).

Via HN: https://news.ycombinator.com/item?id=47686431

On Lobsters: https://lobste.rs/s/t7fe6r/freestanding_c_standard_library

#Programming #CPP #Embedded #OSDev #CPlusPlus

Freestanding standard library

In some earlier articles, we used the term freestanding. We said that a freestanding implementation is one that operates without the support of a hosted operating system. Think embedded systems, OS kernels, or bare-metal environments where heap allocation, system calls, and exception support are typically unavailable. The C++ standard defines a minimal subset of the language and library that must work in such constrained environments. But I wanted to go slightly deeper, because the term doesn’t come up much in everyday C++ — at least not until you start reading the standard more carefully or until you need to use such an implementation.

Sandor Dargo’s Blog

Unfortunately, it stops short of telling you *how* to use a freestanding standard library. 🤦🏽‍♂️

(Use `-ffreestanding` with GCC or Clang.)