Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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="http://llvm.org/">LLVM Home</a> |
| 16 | </div> |
Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 17 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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> |
Tanya Lattner | d08dbfc | 2015-08-05 03:59:14 +0000 | [diff] [blame] | 25 | <a href="http://lists.llvm.org/mailman/listinfo/cfe-dev">cfe-dev</a> |
| 26 | <a href="http://lists.llvm.org/mailman/listinfo/cfe-commits">cfe-commits</a> |
Eric Fiselier | b7fd0be | 2017-02-17 08:37:03 +0000 | [diff] [blame^] | 27 | <a href="https://bugs.llvm.org/">Bug Reports</a> |
Howard Hinnant | 76e1ffc | 2010-05-11 20:51:20 +0000 | [diff] [blame] | 28 | <a href="http://llvm.org/svn/llvm-project/libcxx/trunk/">Browse SVN</a> |
| 29 | <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/">Browse ViewVC</a> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 30 | </div> |
| 31 | </div> |
| 32 | |
| 33 | <div id="content"> |
| 34 | <!--*********************************************************************--> |
| 35 | <h1>"libc++" C++ Standard Library</h1> |
| 36 | <!--*********************************************************************--> |
Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 37 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 38 | <p>libc++ is a new implementation of the C++ standard library, targeting |
Howard Hinnant | af34734 | 2012-07-19 15:57:51 +0000 | [diff] [blame] | 39 | C++11.</p> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 40 | |
Chris Lattner | f38bc6e | 2010-11-16 21:40:19 +0000 | [diff] [blame] | 41 | <p>All of the code in libc++ is <a |
| 42 | href="http://llvm.org/docs/DeveloperPolicy.html#license">dual licensed</a> |
| 43 | under the MIT license and the UIUC License (a BSD-like license).</p> |
Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 44 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 45 | <!--=====================================================================--> |
Eric Fiselier | d1e2a83 | 2015-10-14 20:51:33 +0000 | [diff] [blame] | 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="http://libcxx.llvm.org/docs/"> |
| 53 | Click here for the new libc++ documentation.</a></p> |
| 54 | |
| 55 | <!--=====================================================================--> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 56 | <h2 id="goals">Features and Goals</h2> |
| 57 | <!--=====================================================================--> |
Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 58 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 59 | <ul> |
Howard Hinnant | af34734 | 2012-07-19 15:57:51 +0000 | [diff] [blame] | 60 | <li>Correctness as defined by the C++11 standard.</li> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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 | <!--=====================================================================--> |
Marshall Clow | faa1716 | 2012-11-14 16:31:15 +0000 | [diff] [blame] | 70 | <h2 id="why">Why a new C++ Standard Library for C++11?</h2> |
Chris Lattner | 24173b8 | 2010-05-12 22:21:15 +0000 | [diff] [blame] | 71 | <!--=====================================================================--> |
Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 72 | |
Chris Lattner | 24173b8 | 2010-05-12 22:21:15 +0000 | [diff] [blame] | 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> |
Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 77 | |
Chris Lattner | 24173b8 | 2010-05-12 22:21:15 +0000 | [diff] [blame] | 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 |
Marshall Clow | faa1716 | 2012-11-14 16:31:15 +0000 | [diff] [blame] | 85 | machines (particularly in C++11, which has rvalue references). Breaking |
Chris Lattner | a5058d9 | 2010-05-12 22:30:22 +0000 | [diff] [blame] | 86 | ABI compatibility with old versions of the library was |
Chris Lattner | 24173b8 | 2010-05-12 22:21:15 +0000 | [diff] [blame] | 87 | determined to be critical to achieving the performance goals of |
| 88 | libc++.</p></li> |
Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 89 | |
Chris Lattner | 24173b8 | 2010-05-12 22:21:15 +0000 | [diff] [blame] | 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 |
Marshall Clow | faa1716 | 2012-11-14 16:31:15 +0000 | [diff] [blame] | 92 | independently extended to support C++11, but this would be a fork of the |
Chris Lattner | f338249 | 2010-05-12 22:33:00 +0000 | [diff] [blame] | 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> |
Chris Lattner | 24173b8 | 2010-05-12 22:21:15 +0000 | [diff] [blame] | 97 | </li> |
| 98 | |
| 99 | <li><p>STLport and the Apache libstdcxx library are two other popular |
Marshall Clow | faa1716 | 2012-11-14 16:31:15 +0000 | [diff] [blame] | 100 | candidates, but both lack C++11 support. Our experience (and the |
Howard Hinnant | af34734 | 2012-07-19 15:57:51 +0000 | [diff] [blame] | 101 | experience of libstdc++ developers) is that adding support for C++11 (in |
Chris Lattner | 24173b8 | 2010-05-12 22:21:15 +0000 | [diff] [blame] | 102 | particular rvalue references and move-only types) requires changes to |
| 103 | almost every class and function, essentially amounting to a rewrite. |
Chris Lattner | bfa808e | 2010-05-12 22:34:21 +0000 | [diff] [blame] | 104 | Faced with a rewrite, we decided to start from scratch and evaluate every |
| 105 | design decision from first principles based on experience.</p> |
Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 106 | |
Chris Lattner | 24173b8 | 2010-05-12 22:21:15 +0000 | [diff] [blame] | 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 | <!--=====================================================================--> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 113 | <h2 id="requirements">Platform Support</h2> |
| 114 | <!--=====================================================================--> |
| 115 | |
Dan Albert | 35d775d | 2014-08-11 15:12:46 +0000 | [diff] [blame] | 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 <atomic> is only functional with |
| 120 | clang. |
| 121 | </p> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 122 | |
Dan Albert | 35d775d | 2014-08-11 15:12:46 +0000 | [diff] [blame] | 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> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 130 | |
| 131 | <!--=====================================================================--> |
| 132 | <h2 id="dir-structure">Current Status</h2> |
| 133 | <!--=====================================================================--> |
| 134 | |
Howard Hinnant | b0895ff | 2012-11-27 18:52:32 +0000 | [diff] [blame] | 135 | <p>libc++ is a 100% complete C++11 implementation on Apple's OS X. </p> |
Michael J. Spencer | db8a030 | 2012-12-31 19:34:21 +0000 | [diff] [blame] | 136 | <p>LLVM and Clang can self host in C++ and C++11 mode with libc++ on Linux.</p> |
Dan Albert | e3eda9d | 2015-01-30 22:33:41 +0000 | [diff] [blame] | 137 | <p>libc++ is also a 100% complete C++14 implementation. A list of new features and changes for |
Marshall Clow | e4915d9 | 2014-04-03 02:35:29 +0000 | [diff] [blame] | 138 | C++14 can be found <a href="cxx1y_status.html">here</a>.</p> |
Marshall Clow | 1e895c1 | 2014-11-10 15:43:20 +0000 | [diff] [blame] | 139 | <p>A list of features and changes for the next C++ standard, known here as |
| 140 | "C++1z" (probably to be C++17) can be found <a href="cxx1z_status.html">here</a>.</p> |
Marshall Clow | d2f0b5c | 2014-06-02 23:37:13 +0000 | [diff] [blame] | 141 | <p>Implementation of the post-c++14 Technical Specifications is in progress. A list of features and |
| 142 | the current status of these features can be found <a href="ts1z_status.html">here</a>.</p> |
Howard Hinnant | 0cbb3a1 | 2011-09-28 15:44:39 +0000 | [diff] [blame] | 143 | |
Eric Fiselier | caf1c02 | 2014-08-18 05:25:04 +0000 | [diff] [blame] | 144 | <!--======================================================================--> |
Dan Albert | e3eda9d | 2015-01-30 22:33:41 +0000 | [diff] [blame] | 145 | <h2 id="buildbots">Build Bots</h2> |
Eric Fiselier | caf1c02 | 2014-08-18 05:25:04 +0000 | [diff] [blame] | 146 | <!--======================================================================--> |
Eric Fiselier | 453a500 | 2014-12-09 22:53:21 +0000 | [diff] [blame] | 147 | <p>The latest libc++ build results can be found at the following locations.</p> |
Eric Fiselier | caf1c02 | 2014-08-18 05:25:04 +0000 | [diff] [blame] | 148 | <ul> |
Eric Fiselier | 453a500 | 2014-12-09 22:53:21 +0000 | [diff] [blame] | 149 | <li><a href="http://lab.llvm.org:8011/console"> |
| 150 | Buildbot libc++ builders |
Eric Fiselier | caf1c02 | 2014-08-18 05:25:04 +0000 | [diff] [blame] | 151 | </a></li> |
Eric Fiselier | 453a500 | 2014-12-09 22:53:21 +0000 | [diff] [blame] | 152 | <li><a href="http://lab.llvm.org:8080/green/view/Libcxx/"> |
| 153 | Jenkins libc++ builders |
Eric Fiselier | a43d114 | 2014-10-16 02:48:59 +0000 | [diff] [blame] | 154 | </a></li> |
Eric Fiselier | caf1c02 | 2014-08-18 05:25:04 +0000 | [diff] [blame] | 155 | </ul> |
| 156 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 157 | <!--=====================================================================--> |
| 158 | <h2>Get it and get involved!</h2> |
| 159 | <!--=====================================================================--> |
Howard Hinnant | d2bb032 | 2010-08-22 01:04:38 +0000 | [diff] [blame] | 160 | |
Howard Hinnant | 2481cba | 2011-09-30 16:58:02 +0000 | [diff] [blame] | 161 | <p>First please review our |
| 162 | <a href="http://llvm.org/docs/DeveloperPolicy.html">Developer's Policy</a>. |
| 163 | |
Eric Fiselier | d256280 | 2016-06-02 02:16:28 +0000 | [diff] [blame] | 164 | The documentation for building and using libc++ can be found below. |
| 165 | <ul> |
| 166 | <li><a href="http://libcxx.llvm.org/docs/UsingLibcxx.html"> |
| 167 | <b>Using libc++</b></a> |
| 168 | Documentation on using the library in your programs</li> |
| 169 | <li><a href="http://libcxx.llvm.org/docs/BuildingLibcxx.html"> |
| 170 | <b>Building libc++</b></a> |
| 171 | Documentation on building the library using CMake</li> |
| 172 | <li><a href="http://libcxx.llvm.org/docs/TestingLibcxx.html"> |
| 173 | <b>Testing libc++</b></a> |
| 174 | Documentation for developers wishing to test the library</li> |
| 175 | </ul> |
Dan Albert | 35d775d | 2014-08-11 15:12:46 +0000 | [diff] [blame] | 176 | |
| 177 | <!--=====================================================================--> |
Eric Fiselier | a5ad9ac | 2015-05-12 22:55:30 +0000 | [diff] [blame] | 178 | <h3>Notes and Known Issues</h3> |
Dan Albert | 35d775d | 2014-08-11 15:12:46 +0000 | [diff] [blame] | 179 | <!--=====================================================================--> |
| 180 | |
| 181 | <p> |
Eric Fiselier | a5ad9ac | 2015-05-12 22:55:30 +0000 | [diff] [blame] | 182 | <ul> |
| 183 | <li> |
| 184 | Building libc++ with <code>-fno-rtti</code> is not supported. However |
| 185 | linking against it with <code>-fno-rtti</code> is supported. |
| 186 | </li> |
| 187 | <li> |
| 188 | On OS X v10.8 and older the CMake option |
| 189 | <code>-DLIBCXX_LIBCPPABI_VERSION=""</code> must be used during |
| 190 | configuration. |
| 191 | </li> |
| 192 | </ul> |
Dan Albert | 35d775d | 2014-08-11 15:12:46 +0000 | [diff] [blame] | 193 | </p> |
| 194 | |
| 195 | <p>Send discussions to the |
Tanya Lattner | d08dbfc | 2015-08-05 03:59:14 +0000 | [diff] [blame] | 196 | <a href="http://lists.llvm.org/mailman/listinfo/cfe-dev">clang mailing list</a>.</p> |
Dan Albert | 35d775d | 2014-08-11 15:12:46 +0000 | [diff] [blame] | 197 | |
| 198 | <!--=====================================================================--> |
Marshall Clow | 992f9d5 | 2014-04-03 03:13:12 +0000 | [diff] [blame] | 199 | <h2>Bug reports and patches</h2> |
| 200 | <!--=====================================================================--> |
| 201 | |
Dan Albert | e3eda9d | 2015-01-30 22:33:41 +0000 | [diff] [blame] | 202 | <p> |
| 203 | If you think you've found a bug in libc++, please report it using |
| 204 | the <a href="http://llvm.org/bugs">LLVM Bugzilla</a>. If you're not sure, you |
Tanya Lattner | d08dbfc | 2015-08-05 03:59:14 +0000 | [diff] [blame] | 205 | can post a message to the <a href="http://lists.llvm.org/mailman/listinfo/cfe-dev">cfe-dev</a> |
Dan Albert | e3eda9d | 2015-01-30 22:33:41 +0000 | [diff] [blame] | 206 | mailing list or on IRC. Please include "libc++" in your subject. |
| 207 | </p> |
Marshall Clow | 992f9d5 | 2014-04-03 03:13:12 +0000 | [diff] [blame] | 208 | |
Dan Albert | e3eda9d | 2015-01-30 22:33:41 +0000 | [diff] [blame] | 209 | <p> |
| 210 | If you want to contribute a patch to libc++, the best place for that is |
| 211 | <a href="http://llvm.org/docs/Phabricator.html">Phabricator</a>. Please |
| 212 | include [libc++] in the subject and add cfe-commits as a subscriber. |
| 213 | </p> |
Marshall Clow | 992f9d5 | 2014-04-03 03:13:12 +0000 | [diff] [blame] | 214 | |
| 215 | <!--=====================================================================--> |
Howard Hinnant | 56f0d5b | 2010-10-05 16:44:40 +0000 | [diff] [blame] | 216 | <h2>Design Documents</h2> |
| 217 | <!--=====================================================================--> |
| 218 | |
| 219 | <ul> |
| 220 | <li><a href="atomic_design.html"><tt><atomic></tt></a></li> |
Howard Hinnant | 9835d76 | 2010-11-19 01:38:58 +0000 | [diff] [blame] | 221 | <li><a href="type_traits_design.html"><tt><type_traits></tt></a></li> |
Marshall Clow | e47bc9b | 2013-03-14 19:00:34 +0000 | [diff] [blame] | 222 | <li><a href="http://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/">Excellent notes by Marshall Clow</a></li> |
Howard Hinnant | 56f0d5b | 2010-10-05 16:44:40 +0000 | [diff] [blame] | 223 | </ul> |
| 224 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 225 | </div> |
| 226 | </body> |
Chris Lattner | 4b74895 | 2010-05-11 20:37:52 +0000 | [diff] [blame] | 227 | </html> |