#####  [ cppreference.com ](/)

[ Log in
](/mwiki/index.php?title=Special:UserLogin&returnto=cpp%2Ffreestanding "You
are encouraged to log in; however, it is not mandatory \[o\]")

#####  Namespaces

  * [ Page ](/w/cpp/freestanding "View the content page \[c\]")
  * [ Discussion ](/mwiki/index.php?title=Talk:cpp/freestanding&action=edit&redlink=1 "Discussion about the content page \[t\]")

#####  Variants

#####  Views

  * [ View ](/w/cpp/freestanding)
  * [ Edit ](/mwiki/index.php?title=cpp/freestanding&action=edit "You can edit this page. Please use the preview button before saving \[e\]")
  * [ History ](/mwiki/index.php?title=cpp/freestanding&action=history "Past revisions of this page \[h\]")

#####  Actions

#  Freestanding and hosted implementations

From cppreference.com

< [ cpp ](/w/cpp "cpp")

[ C++ ](/w/cpp "cpp")

[ Compiler support ](/w/cpp/compiler_support "cpp/compiler support")  
---  
**Freestanding and hosted**  
[ Language ](/w/cpp/language "cpp/language")  
[ Standard library ](/w/cpp/standard_library "cpp/standard library")  
[ Standard library headers ](/w/cpp/header "cpp/header")  
[ Named requirements ](/w/cpp/named_req "cpp/named req")  
[ Feature test macros ](/w/cpp/feature_test "cpp/feature test") (C++20)  
[ Language support library ](/w/cpp/utility#Language_support "cpp/utility")  
[ Concepts library ](/w/cpp/concepts "cpp/concepts") (C++20)  
[ Metaprogramming library ](/w/cpp/meta "cpp/meta") (C++11)  
[ Diagnostics library ](/w/cpp/error "cpp/error")  
[ General utilities library ](/w/cpp/utility "cpp/utility")  
[ Strings library ](/w/cpp/string "cpp/string")  
[ Containers library ](/w/cpp/container "cpp/container")  
[ Iterators library ](/w/cpp/iterator "cpp/iterator")  
[ Ranges library ](/w/cpp/ranges "cpp/ranges") (C++20)  
[ Algorithms library ](/w/cpp/algorithm "cpp/algorithm")  
[ Numerics library ](/w/cpp/numeric "cpp/numeric")  
[ Localizations library ](/w/cpp/locale "cpp/locale")  
[ Input/output library ](/w/cpp/io "cpp/io")  
[ Filesystem library ](/w/cpp/filesystem "cpp/filesystem") (C++17)  
[ Regular expressions library ](/w/cpp/regex "cpp/regex") (C++11)  
[ Concurrency support library ](/w/cpp/thread "cpp/thread") (C++11)  
[ Technical specifications ](/w/cpp/experimental "cpp/experimental")  
[ Symbols index ](/w/cpp/symbol_index "cpp/symbol index")  
[ External libraries ](/w/cpp/links/libs "cpp/links/libs")  
  
[ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/navbar_content&action=edit)

There are two kinds of implementations defined by the C++ standard:
_**hosted** _ and _**freestanding** _ implementations. For _hosted_
implementations, the set of standard library headers required by the C++
standard is much larger than for _freestanding_ ones. In a _freestanding_
implementation, execution may happen without an operating system.

The kind of the implementation is implementation-defined.  The macro `
__STDC_HOSTED__ ` is predefined to ` 1 ` for hosted implementations and ` 0 `
for freestanding implementations.  (since C++11)

|

##  Contents

  * 1  Requirements on multi-threaded executions and data races 
  * 2  Requirements on the main function 
  * 3  Requirements on standard library headers 
  * 4  Notes 
  * 5  References 
  * 6  Defect reports 
  * 7  See also 

  
---  
  
###  Requirements on [ multi-threaded executions and data races
](/w/cpp/language/memory_model "cpp/language/memory model")

_freestanding_ |  _hosted_  
---|---  
Under a _freestanding_ implementation, it is implementation-defined whether a program can have more than one [ thread of execution ](/w/cpp/thread "cpp/thread") .  |  Under a _hosted_ implementation, a C++ program can have more than one [ thread ](/w/cpp/thread "cpp/thread") running concurrently.   
(since C++11)  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/freestanding&action=edit&section=2
"Edit section: Requirements on the main function") ]  Requirements on the [ `
main ` ](/w/cpp/language/main_funct