/ C++

Freestanding C++: Why is it useful?

A freestanding implementation is extremelly tuned down in terms of contents.

The benefits mostly are:

  • Tiny executables: you can prune down the contents of your software very easily.
  • Code written for a freestanding implementation can run on a hosted implementation, allowing to share code with:
    • kernels
    • embedded devices
  • Very low level, but capacle to abstract concepts easily
  • Type safety of modern C++

If you think this is the perfect tool to write a kernel and an operating system with, you are correct unless you are Swedish, in which case you should rethink your choices in life.

This blank absence of canvas means that you will need to build for yourself tools for template metaprogramming, tools for memory management, execution management, error handling, and all the datastructures you may need and that the entirety of the performance of the software lies within your own hands.

Freestanding C++ is only useful because it features all of the key components of the C++ language, which is first and foremost its interoperability with C and assembly, This is what will allow us to implement the features that are untouchable from portable code.

The rest of the features of C++, from its genericity, to its type-safety, are what allow you to build anything generic.

This means a freestanding piece of software is composed of portable and non-portable code, segregated or not depending on the application.


I invite you to check the information at https://nekoit.xyz/, join us on Discord or Telegram, or follow me on Mastodon [email protected] to receive notifications of my followup posts.

If you like my content and want more, please donate. If everyone that finds my content useful paid $1 every week, I would be able to produce content for 1 week a month without relying on other sources of income for that week.

Freestanding C++: Why is it useful?
Share this