Freestanding (C++ implementation)

From Wikipedia, the free encyclopedia

Freestanding implementation is a C/C++ programming language term that refers to an implementation in which the execution of the program does not rely on an operating system.[1] Unlike a hosted implementation, a freestanding implementation does not provide the entire C standard library or C++ standard library, providing a non-operating system and non-dynamic memory-dependent subset.

Newer C/C++ standards and proposals have worked to extend the freestanding subset of the C and C++ standard libraries.[2]

Freestanding implementations are generally used for operating system development and embedded systems due to not relying on any operating system, where resource constraints are far more strict.

In a hosted implementation, the program requires the entry point to be a global function called main(), while in a freestanding implementation it is implementation-defined. While _start() is typically the general default for the entry point function in many environments, this may be overridden.[3] Under a hosted implementation, a C++ program is required to support concurrently executing threads, while in a freestanding implementation, this is implementation defined.[1]

Under a freestanding implementation, the predefined macro __STDC_HOSTED__ will always expand to 0, while being expanded to 1 in hosted implementations.[1]

Header set

See also

References

Related Articles

Wikiwand AI