C++: Freestanding Standard Library

April 10, 2026
A vintage circuit board with protruding components and connectors on a white background.
Photo by Nicolas Foster on Pexels

What “freestanding” actually means

Freestanding C++ runs with no hosted OS comforts — think embedded devices, kernels, bare-metal boards. It’s more than a buzzword: the standard defines a minimal subset of the language and library that must work in those constrained environments. You can check where you stand with the __STDC_HOSTED__ macro: 1 means hosted, 0 means freestanding. Differences matter: thread support, the requirement for a global main, and even which headers must exist are implementation-defined for freestanding targets. What does a program do without main? Startup and termination can still run — static constructors and destructors still fire — but there’s no free lunch and vendors aren’t obliged to ship a freestanding implementation; it has been reported that coverage varies widely.

The stripped-down but useful subset

Freestanding isn’t a void; it supplies low-level, self-contained utilities that don’t rely on an OS. Expect headers like , , , and , and parts of , while OS-heavy features — , , — are typically absent. Dynamic allocation and exceptions are not guaranteed either. In practice, freestanding gives you the building blocks of modern C++: fixed-width integers, size types, compile-time type traits, and numeric limits — but not the higher-level conveniences you’d take for granted on a desktop.

Modern C++ is pushing the boundary

The good news? Freestanding has been expanding. C++20, C++23 and now C++26 have steadily moved more library facilities into the freestanding realm — things like algorithms, utilities, std::span, std::expected, std::mdspan, and smart-pointer adapters such as out_ptr and inout_ptr are increasingly usable without an OS. This isn’t accidental; embedded systems and game development have pushed hard for better abstractions. The result: you can write more expressive, higher-level C++ on tiny targets without reinventing the wheel. Who wouldn’t want modern C++ that truly works everywhere?

Sources: sandordargo.com, Hacker News