title: Is there a meaningful distinction between freestanding and hosted implementations?
body: <p>The question I have is mostly related to <a href="http://www.iso-9899.info/n1570.html#4.p6" rel="noreferrer">section four, paragraph six</a>.</p>
  
  <blockquote>
    <p>The two forms of conforming implementation are hosted and freestanding. A conforming hosted implementation shall accept any strictly conforming program.</p>
  </blockquote>
  
  <p>As I understand, this constitutes the typical application environment, with filesystems, allocated memory and threads...</p>
  
  <blockquote>
    <p>A conforming freestanding implementation shall accept any strictly conforming program in which the use of the features specified in the library clause (clause 7) is confined to the contents of the standard headers <code>&lt;float.h&gt;</code>, <code>&lt;iso646.h&gt;</code>, <code>&lt;limits.h&gt;</code>, <code>&lt;stdalign.h&gt;</code>, <code>&lt;stdarg.h&gt;</code>, <code>&lt;stdbool.h&gt;</code>, <code>&lt;stddef.h&gt;</code>, <code>&lt;stdint.h&gt;</code>, and <code>&lt;stdnoreturn.h&gt;</code>.</p>
  </blockquote>
  
  <p>... and this constitutes the typical kernel and/or embedded, bare minimum environment that <em>doesn't</em> have standard filesystems, allocated memory or threads (among other things).</p>
  
  <blockquote>
    <p>A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any strictly conforming program.</p>
  </blockquote>
  
  <p>It seems as though this gives a hosted implementation the freedom to call itself a hosted or freestanding implementation, and when it comes to filesystems, allocated memory or threads (among other things), these can fall under the <em>extension</em> category so that it can merely implement an interface that returns a value indicating errors every time. Just to name a few:</p>
  
  <ul>
  <li><code>fopen</code>, <code>fgets</code> and <code>malloc</code> can return <code>NULL</code></li>
  <li><code>fprintf</code>, <code>fscanf</code>, <code>fputc</code> and <code>fgetc</code> can return <code>EOF</code></li>
  <li><code>thrd_create</code> can return <code>thrd_error</code> (indicating that "the request could not be honored")</li>
  </ul>
  
  <p>This implies that the distinction section four, paragraph six gives is virtually meaningless. Are there any requirements guaranteeing some actual level of functionality for these functions in hosted and freestanding implementations? For example, is it required that those functions above actually be able to return something other than their corresponding failure values?</p>