index.html revision f33824922812487c1e7f24852975b0e06792eb7e
1bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 2bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant "http://www.w3.org/TR/html4/strict.dtd"> 3bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant<!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ --> 4bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant<html> 5bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant<head> 6bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 7bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <title>"libc++" C++ Standard Library</title> 8bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <link type="text/css" rel="stylesheet" href="menu.css"> 9bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <link type="text/css" rel="stylesheet" href="content.css"> 10bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant</head> 11bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 12bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant<body> 13bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant<div id="menu"> 14bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <div> 15bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <a href="http://llvm.org/">LLVM Home</a> 16bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant </div> 17bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 18bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <div class="submenu"> 19bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <label>libc++ Info</label> 20bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <a href="/index.html">About</a> 21bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant </div> 22bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 23bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <div class="submenu"> 24bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <label>Quick Links</label> 25a535ffd99d3702ab065647e28e83c2b7d720be3dChris Lattner <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">cfe-dev</a> 26a535ffd99d3702ab065647e28e83c2b7d720be3dChris Lattner <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">cfe-commits</a> 27bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <a href="http://llvm.org/bugs/">Bug Reports</a> 2876e1ffc6036a7e772827228e4626280caddbc354Howard Hinnant <a href="http://llvm.org/svn/llvm-project/libcxx/trunk/">Browse SVN</a> 2976e1ffc6036a7e772827228e4626280caddbc354Howard Hinnant <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/">Browse ViewVC</a> 30bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant </div> 31bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant</div> 32bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 33bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant<div id="content"> 34bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--*********************************************************************--> 35bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <h1>"libc++" C++ Standard Library</h1> 36bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--*********************************************************************--> 37bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 38bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <p>libc++ is a new implementation of the C++ standard library, targeting 39bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant C++0X.</p> 40bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 41bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <p>All of the code in libc++ is available under the standard 42bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <a href="http://llvm.org/docs/DeveloperPolicy.html#license">LLVM 43bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant License</a>, a "BSD-style" license.</p> 44bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 45bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--=====================================================================--> 46bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <h2 id="goals">Features and Goals</h2> 47bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--=====================================================================--> 48bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 49bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <ul> 50bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li>Correctness as defined by the (currently draft) C++0X standard.</li> 51bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li>Fast execution.</li> 52bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li>Minimal memory use.</li> 53bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li>Fast compile times.</li> 54bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li>ABI compatibility with gcc's libstdc++ for some low-level features 55bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant such as exception objects, rtti and memory allocation.</li> 56bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li>Extensive unit tests.</li> 57bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant </ul> 58bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 59bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--=====================================================================--> 6024173b81dd527a38b32e037082f7d1578213d626Chris Lattner <h2 id="why">Why a new C++ Standard Library for C++'0x?</h2> 6124173b81dd527a38b32e037082f7d1578213d626Chris Lattner <!--=====================================================================--> 6224173b81dd527a38b32e037082f7d1578213d626Chris Lattner 6324173b81dd527a38b32e037082f7d1578213d626Chris Lattner <p>After its initial introduction, many people have asked "why start a new 6424173b81dd527a38b32e037082f7d1578213d626Chris Lattner library instead of contributing to an existing library?" (like Apache's 6524173b81dd527a38b32e037082f7d1578213d626Chris Lattner libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing 6624173b81dd527a38b32e037082f7d1578213d626Chris Lattner reasons, but some of the major ones are:</p> 6724173b81dd527a38b32e037082f7d1578213d626Chris Lattner 6824173b81dd527a38b32e037082f7d1578213d626Chris Lattner <ul> 6924173b81dd527a38b32e037082f7d1578213d626Chris Lattner <li><p>From years of experience (including having implemented the standard 7024173b81dd527a38b32e037082f7d1578213d626Chris Lattner library before), we've learned many things about implementing 7124173b81dd527a38b32e037082f7d1578213d626Chris Lattner the standard containers which require ABI breakage and fundamental changes 7224173b81dd527a38b32e037082f7d1578213d626Chris Lattner to how they are implemented. For example, it is generally accepted that 7324173b81dd527a38b32e037082f7d1578213d626Chris Lattner building std::string using the "short string optimization" instead of 7424173b81dd527a38b32e037082f7d1578213d626Chris Lattner using Copy On Write (COW) is a superior approach for multicore 75a5058d9a0d5e60adcd9118dfe7f886effd6a6206Chris Lattner machines (particularly in C++'0x, which has rvalue references). Breaking 76a5058d9a0d5e60adcd9118dfe7f886effd6a6206Chris Lattner ABI compatibility with old versions of the library was 7724173b81dd527a38b32e037082f7d1578213d626Chris Lattner determined to be critical to achieving the performance goals of 7824173b81dd527a38b32e037082f7d1578213d626Chris Lattner libc++.</p></li> 7924173b81dd527a38b32e037082f7d1578213d626Chris Lattner 8024173b81dd527a38b32e037082f7d1578213d626Chris Lattner <li><p>Mainline libstdc++ has switched to GPL3, a license which the developers 8124173b81dd527a38b32e037082f7d1578213d626Chris Lattner of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be 8224173b81dd527a38b32e037082f7d1578213d626Chris Lattner independently extended to support C++'0x, but this would be a fork of the 83f33824922812487c1e7f24852975b0e06792eb7eChris Lattner codebase (which is often seen as worse for a project than starting a new 84f33824922812487c1e7f24852975b0e06792eb7eChris Lattner independent one). Another problem with libstdc++ is that it is tightly 85f33824922812487c1e7f24852975b0e06792eb7eChris Lattner integrated with G++ development, tending to be tied fairly closely to the 86f33824922812487c1e7f24852975b0e06792eb7eChris Lattner matching version of G++.</p> 8724173b81dd527a38b32e037082f7d1578213d626Chris Lattner </li> 8824173b81dd527a38b32e037082f7d1578213d626Chris Lattner 8924173b81dd527a38b32e037082f7d1578213d626Chris Lattner <li><p>STLport and the Apache libstdcxx library are two other popular 9024173b81dd527a38b32e037082f7d1578213d626Chris Lattner candidates, but both lack C++'0x support. Our experience (and the 9124173b81dd527a38b32e037082f7d1578213d626Chris Lattner experience of libstdc++ developers) is that adding support for C++0x (in 9224173b81dd527a38b32e037082f7d1578213d626Chris Lattner particular rvalue references and move-only types) requires changes to 9324173b81dd527a38b32e037082f7d1578213d626Chris Lattner almost every class and function, essentially amounting to a rewrite. 9424173b81dd527a38b32e037082f7d1578213d626Chris Lattner Faced with a rewrite, we decided to start from scratch and evaluate every 9524173b81dd527a38b32e037082f7d1578213d626Chris Lattner decision based from first principles based on experience.</p> 9624173b81dd527a38b32e037082f7d1578213d626Chris Lattner 9724173b81dd527a38b32e037082f7d1578213d626Chris Lattner <p>Further, both projects are apparently abandoned: STLport 5.2.1 was 9824173b81dd527a38b32e037082f7d1578213d626Chris Lattner released in Oct'08, and STDCXX 4.2.1 in May'08.</p> 9924173b81dd527a38b32e037082f7d1578213d626Chris Lattner 10024173b81dd527a38b32e037082f7d1578213d626Chris Lattner </ul> 10124173b81dd527a38b32e037082f7d1578213d626Chris Lattner 10224173b81dd527a38b32e037082f7d1578213d626Chris Lattner <!--=====================================================================--> 103bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <h2 id="requirements">Platform Support</h2> 104bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--=====================================================================--> 105bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 106bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <p>libc++ is known to work on the following platforms, using g++-4.2 and 107bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant clang (lack of C++0X language support disables some functionality).</p> 108bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 109bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <ul> 110bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li>Mac OS X i386</li> 111bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li>Mac OS X x86_64</li> 112bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant </ul> 113bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 114bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--=====================================================================--> 115bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <h2 id="dir-structure">Current Status</h2> 116bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--=====================================================================--> 117bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 118bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <p>libc++ is still under development. It has about 85% of 119bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3092.pdf">N3092</a> 12024173b81dd527a38b32e037082f7d1578213d626Chris Lattner implemented/tested. C++'98 support is fully featured, and most of C++'0x 12124173b81dd527a38b32e037082f7d1578213d626Chris Lattner support is as well. The only major missing pieces of C++'0x support are 12224173b81dd527a38b32e037082f7d1578213d626Chris Lattner <code><future></code> and <code><regex></code>, and parts of 12324173b81dd527a38b32e037082f7d1578213d626Chris Lattner <code><random></code>.</p> 124bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 125bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <p>libc++ is currently dependent upon a separate library for the low-level 126bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant ABI compatibility with gcc. As a workaround it can be linked against 127bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant gcc's libstdc++.</p> 128bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 129bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--=====================================================================--> 130bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <h2>Get it and get involved!</h2> 131bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <!--=====================================================================--> 132bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 133bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <p>To check out the code, use:</p> 134bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 135bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <ul> 1364b748953a2d51c34127aa9c593477966242e1898Chris Lattner <li><code>svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx</code></li> 1374b748953a2d51c34127aa9c593477966242e1898Chris Lattner <li><code>cd libcxx/lib</code></li> 138bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li><code>/buildit</code></li> 139bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant </ul> 140bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 141bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <p>To run the libc++ test suit (recommended):</p> 142bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 143bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <ul> 1444b748953a2d51c34127aa9c593477966242e1898Chris Lattner <li><code>cd libcxx/test</code></li> 145bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant <li><code>/testit</code></li> 146bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant </ul> 147bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 1488c21737c03f3b266d8679d56faa6b6d091e7f2f1Howard Hinnant <p>Send discussions to the 1498c21737c03f3b266d8679d56faa6b6d091e7f2f1Howard Hinnant (<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">clang mailing list</a>).</p> 1508c21737c03f3b266d8679d56faa6b6d091e7f2f1Howard Hinnant 151bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant</div> 152bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant</body> 1534b748953a2d51c34127aa9c593477966242e1898Chris Lattner</html> 154