index.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ -->
  4. <html>
  5. <head>
  6. <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  7. <title>"libc++" C++ Standard Library</title>
  8. <link type="text/css" rel="stylesheet" href="menu.css">
  9. <link type="text/css" rel="stylesheet" href="content.css">
  10. </head>
  11. <body>
  12. <div id="menu">
  13. <div>
  14. <a href="https://llvm.org/">LLVM Home</a>
  15. </div>
  16. <div class="submenu">
  17. <label>libc++ Info</label>
  18. <a href="/index.html">About</a>
  19. </div>
  20. <div class="submenu">
  21. <label>Quick Links</label>
  22. <a href="https://libcxxabi.llvm.org/">libc++abi</a>
  23. <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libcxx-dev</a>
  24. <a href="https://lists.llvm.org/mailman/listinfo/libcxx-commits">libcxx-commits</a>
  25. <a href="https://bugs.llvm.org/">Bug Reports</a>
  26. <a href="https://github.com/llvm/llvm-project/tree/master/libcxx/">Browse Sources</a>
  27. </div>
  28. </div>
  29. <div id="content">
  30. <!--*********************************************************************-->
  31. <h1>"libc++" C++ Standard Library</h1>
  32. <!--*********************************************************************-->
  33. <p>libc++ is an implementation of the C++ standard library, targeting
  34. C++11, C++14 and above.</p>
  35. <p>All of the code in libc++ is <a
  36. href="https://llvm.org/docs/DeveloperPolicy.html#license">dual licensed</a>
  37. under the MIT license and the UIUC License (a BSD-like license).</p>
  38. <!--=====================================================================-->
  39. <h2>New Documentation Coming Soon!</h2>
  40. <!--=====================================================================-->
  41. <p> Looking for documentation on how to use, build and test libc++? If so
  42. checkout the new libc++ documentation.</p>
  43. <p><a href="https://libcxx.llvm.org/docs/">
  44. Click here for the new libc++ documentation.</a></p>
  45. <!--=====================================================================-->
  46. <h2 id="goals">Features and Goals</h2>
  47. <!--=====================================================================-->
  48. <ul>
  49. <li>Correctness as defined by the C++11 standard.</li>
  50. <li>Fast execution.</li>
  51. <li>Minimal memory use.</li>
  52. <li>Fast compile times.</li>
  53. <li>ABI compatibility with gcc's libstdc++ for some low-level features
  54. such as exception objects, rtti and memory allocation.</li>
  55. <li>Extensive unit tests.</li>
  56. </ul>
  57. <!--=====================================================================-->
  58. <h2 id="why">Why a new C++ Standard Library for C++11?</h2>
  59. <!--=====================================================================-->
  60. <p>After its initial introduction, many people have asked "why start a new
  61. library instead of contributing to an existing library?" (like Apache's
  62. libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
  63. reasons, but some of the major ones are:</p>
  64. <ul>
  65. <li><p>From years of experience (including having implemented the standard
  66. library before), we've learned many things about implementing
  67. the standard containers which require ABI breakage and fundamental changes
  68. to how they are implemented. For example, it is generally accepted that
  69. building std::string using the "short string optimization" instead of
  70. using Copy On Write (COW) is a superior approach for multicore
  71. machines (particularly in C++11, which has rvalue references). Breaking
  72. ABI compatibility with old versions of the library was
  73. determined to be critical to achieving the performance goals of
  74. libc++.</p></li>
  75. <li><p>Mainline libstdc++ has switched to GPL3, a license which the developers
  76. of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
  77. independently extended to support C++11, but this would be a fork of the
  78. codebase (which is often seen as worse for a project than starting a new
  79. independent one). Another problem with libstdc++ is that it is tightly
  80. integrated with G++ development, tending to be tied fairly closely to the
  81. matching version of G++.</p>
  82. </li>
  83. <li><p>STLport and the Apache libstdcxx library are two other popular
  84. candidates, but both lack C++11 support. Our experience (and the
  85. experience of libstdc++ developers) is that adding support for C++11 (in
  86. particular rvalue references and move-only types) requires changes to
  87. almost every class and function, essentially amounting to a rewrite.
  88. Faced with a rewrite, we decided to start from scratch and evaluate every
  89. design decision from first principles based on experience.</p>
  90. <p>Further, both projects are apparently abandoned: STLport 5.2.1 was
  91. released in Oct'08, and STDCXX 4.2.1 in May'08.</p>
  92. </ul>
  93. <!--=====================================================================-->
  94. <h2 id="requirements">Platform Support</h2>
  95. <!--=====================================================================-->
  96. <p>
  97. libc++ is known to work on the following platforms, using g++ and
  98. clang. Note that functionality provided by &lt;atomic&gt; is only functional with
  99. clang.
  100. </p>
  101. <ul>
  102. <li>Mac OS X i386</li>
  103. <li>Mac OS X x86_64</li>
  104. <li>FreeBSD 10+ i386</li>
  105. <li>FreeBSD 10+ x86_64</li>
  106. <li>FreeBSD 10+ ARM</li>
  107. <li>Linux i386</li>
  108. <li>Linux x86_64</li>
  109. </ul>
  110. <!--=====================================================================-->
  111. <h2 id="dir-structure">Current Status</h2>
  112. <!--=====================================================================-->
  113. <p>libc++ is a 100% complete C++11 implementation on Apple's OS X. </p>
  114. <p>LLVM and Clang can self host in C++ and C++11 mode with libc++ on Linux.</p>
  115. <p>libc++ is also a 100% complete C++14 implementation. A list of new features and
  116. changes for C++14 can be found <a href="cxx1y_status.html">here</a>.</p>
  117. <p>libc++'s C++17 implementation is not yet complete. A list of features and changes
  118. for C++17 can be found <a href="cxx1z_status.html">here</a>.</p>
  119. <p>A list of features and changes for the next C++ standard, known here as
  120. "C++2a" (probably to be C++20) can be found <a href="cxx2a_status.html">here</a>.</p>
  121. <p>Implementation of the post-C++14 Technical Specifications is in progress. A list of features
  122. and the current status of these features can be found <a href="ts1z_status.html">here</a>.</p>
  123. <p>As features get moved from the Technical Specifications into the main standard, we
  124. will (after a period for migration) remove them from the TS implementation. This
  125. process is detailed <a href="DesignDocs/ExperimentalFeatures.html">here</a>.</p>
  126. <!--======================================================================-->
  127. <h2 id="buildbots">Build Bots</h2>
  128. <!--======================================================================-->
  129. <p>The latest libc++ build results can be found at the following locations.</p>
  130. <ul>
  131. <li><a href="http://lab.llvm.org:8011/console">
  132. Buildbot libc++ builders
  133. </a></li>
  134. <li><a href="http://lab.llvm.org:8080/green/view/Libcxx/">
  135. Jenkins libc++ builders
  136. </a></li>
  137. </ul>
  138. <!--=====================================================================-->
  139. <h2>Get it and get involved!</h2>
  140. <!--=====================================================================-->
  141. <p>First please review our
  142. <a href="https://llvm.org/docs/DeveloperPolicy.html">Developer's Policy</a>.
  143. The documentation for building and using libc++ can be found below.
  144. <ul>
  145. <li><a href="https://libcxx.llvm.org/docs/UsingLibcxx.html">
  146. <b>Using libc++</b></a>
  147. Documentation on using the library in your programs</li>
  148. <li><a href="https://libcxx.llvm.org/docs/BuildingLibcxx.html">
  149. <b>Building libc++</b></a>
  150. Documentation on building the library using CMake</li>
  151. <li><a href="https://libcxx.llvm.org/docs/TestingLibcxx.html">
  152. <b>Testing libc++</b></a>
  153. Documentation for developers wishing to test the library</li>
  154. </ul>
  155. <!--=====================================================================-->
  156. <h3>Notes and Known Issues</h3>
  157. <!--=====================================================================-->
  158. <p>
  159. <ul>
  160. <li>
  161. Building libc++ with <code>-fno-rtti</code> is not supported. However
  162. linking against it with <code>-fno-rtti</code> is supported.
  163. </li>
  164. </ul>
  165. </p>
  166. <p>Send discussions to the
  167. <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libc++ mailing list</a>.</p>
  168. <!--=====================================================================-->
  169. <h2>Bug reports and patches</h2>
  170. <!--=====================================================================-->
  171. <p>
  172. If you think you've found a bug in libc++, please report it using
  173. the <a href="https://bugs.llvm.org/">LLVM Bugzilla</a>. If you're not sure, you
  174. can post a message to the <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libcxx-dev</a>
  175. mailing list or on IRC.
  176. </p>
  177. <p>
  178. If you want to contribute a patch to libc++, the best place for that is
  179. <a href="https://llvm.org/docs/Phabricator.html">Phabricator</a>. Please
  180. add libcxx-commits as a subscriber.
  181. </p>
  182. <!--=====================================================================-->
  183. <h2>Design Documents</h2>
  184. <!--=====================================================================-->
  185. <ul>
  186. <li><a href="atomic_design.html"><tt>&lt;atomic&gt;</tt></a></li>
  187. <li><a href="type_traits_design.html"><tt>&lt;type_traits&gt;</tt></a></li>
  188. <li><a href="https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/">Excellent notes by Marshall Clow</a></li>
  189. </ul>
  190. </div>
  191. </body>
  192. </html>