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