blob: d7563a78ddf0eaeb202a5bd63207214530700d0c [file] [log] [blame]
Howard Hinnant3e1b0422010-08-22 01:04:38 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
Howard Hinnantc51e1022010-05-11 19:42:16 +00002 "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>
Stephan T. Lavavej1e7fbda2017-08-31 17:59:42 +000015 <a href="https://llvm.org/">LLVM Home</a>
Howard Hinnantc51e1022010-05-11 19:42:16 +000016 </div>
Howard Hinnant3e1b0422010-08-22 01:04:38 +000017
Howard Hinnantc51e1022010-05-11 19:42:16 +000018 <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>
Sylvestre Ledrub0b4dd92018-09-20 07:58:43 +000025 <a href="https://libcxxabi.llvm.org/">libc++abi</a>
Eric Fiselierfa90b7f2018-09-22 19:49:29 +000026 <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libcxx-dev</a>
27 <a href="https://lists.llvm.org/mailman/listinfo/libcxx-commits">libcxx-commits</a>
Eric Fiselier5d604012017-02-17 08:37:03 +000028 <a href="https://bugs.llvm.org/">Bug Reports</a>
James Y Knightf18eebf2019-01-29 16:37:27 +000029 <a href="https://github.com/llvm/llvm-project/tree/master/libcxx/">Browse Sources</a>
Howard Hinnantc51e1022010-05-11 19:42:16 +000030 </div>
31</div>
32
33<div id="content">
34 <!--*********************************************************************-->
35 <h1>"libc++" C++ Standard Library</h1>
36 <!--*********************************************************************-->
Howard Hinnant3e1b0422010-08-22 01:04:38 +000037
Sylvestre Ledru7e245372018-09-20 07:57:31 +000038 <p>libc++ is an implementation of the C++ standard library, targeting
39 C++11, C++14 and above.</p>
Howard Hinnantc51e1022010-05-11 19:42:16 +000040
Chris Lattner7b2aacc2010-11-16 21:40:19 +000041 <p>All of the code in libc++ is <a
Stephan T. Lavavej1e7fbda2017-08-31 17:59:42 +000042 href="https://llvm.org/docs/DeveloperPolicy.html#license">dual licensed</a>
Chris Lattner7b2aacc2010-11-16 21:40:19 +000043 under the MIT license and the UIUC License (a BSD-like license).</p>
Howard Hinnant3e1b0422010-08-22 01:04:38 +000044
Howard Hinnantc51e1022010-05-11 19:42:16 +000045 <!--=====================================================================-->
Eric Fiselier35a5b842015-10-14 20:51:33 +000046 <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
Stephan T. Lavavej1e7fbda2017-08-31 17:59:42 +000052 <p><a href="https://libcxx.llvm.org/docs/">
Eric Fiselier35a5b842015-10-14 20:51:33 +000053 Click here for the new libc++ documentation.</a></p>
54
55 <!--=====================================================================-->
Howard Hinnantc51e1022010-05-11 19:42:16 +000056 <h2 id="goals">Features and Goals</h2>
57 <!--=====================================================================-->
Howard Hinnant3e1b0422010-08-22 01:04:38 +000058
Howard Hinnantc51e1022010-05-11 19:42:16 +000059 <ul>
Howard Hinnantd04724c2012-07-19 15:57:51 +000060 <li>Correctness as defined by the C++11 standard.</li>
Howard Hinnantc51e1022010-05-11 19:42:16 +000061 <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 Clowb6a04fe2012-11-14 16:31:15 +000070 <h2 id="why">Why a new C++ Standard Library for C++11?</h2>
Chris Lattnere2b07272010-05-12 22:21:15 +000071 <!--=====================================================================-->
Howard Hinnant3e1b0422010-08-22 01:04:38 +000072
Chris Lattnere2b07272010-05-12 22:21:15 +000073 <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 Hinnant3e1b0422010-08-22 01:04:38 +000077
Chris Lattnere2b07272010-05-12 22:21:15 +000078 <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 Clowb6a04fe2012-11-14 16:31:15 +000085 machines (particularly in C++11, which has rvalue references). Breaking
Chris Lattnerc67061b2010-05-12 22:30:22 +000086 ABI compatibility with old versions of the library was
Chris Lattnere2b07272010-05-12 22:21:15 +000087 determined to be critical to achieving the performance goals of
88 libc++.</p></li>
Howard Hinnant3e1b0422010-08-22 01:04:38 +000089
Chris Lattnere2b07272010-05-12 22:21:15 +000090 <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 Clowb6a04fe2012-11-14 16:31:15 +000092 independently extended to support C++11, but this would be a fork of the
Chris Lattnere7bdfe62010-05-12 22:33:00 +000093 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 Lattnere2b07272010-05-12 22:21:15 +000097 </li>
98
99 <li><p>STLport and the Apache libstdcxx library are two other popular
Marshall Clowb6a04fe2012-11-14 16:31:15 +0000100 candidates, but both lack C++11 support. Our experience (and the
Howard Hinnantd04724c2012-07-19 15:57:51 +0000101 experience of libstdc++ developers) is that adding support for C++11 (in
Chris Lattnere2b07272010-05-12 22:21:15 +0000102 particular rvalue references and move-only types) requires changes to
103 almost every class and function, essentially amounting to a rewrite.
Chris Lattner48035ce2010-05-12 22:34:21 +0000104 Faced with a rewrite, we decided to start from scratch and evaluate every
105 design decision from first principles based on experience.</p>
Howard Hinnant3e1b0422010-08-22 01:04:38 +0000106
Chris Lattnere2b07272010-05-12 22:21:15 +0000107 <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 Hinnantc51e1022010-05-11 19:42:16 +0000113 <h2 id="requirements">Platform Support</h2>
114 <!--=====================================================================-->
115
Dan Albertce369362014-08-11 15:12:46 +0000116 <p>
Sylvestre Ledru7e245372018-09-20 07:57:31 +0000117 libc++ is known to work on the following platforms, using g++ and
118 clang. Note that functionality provided by &lt;atomic&gt; is only functional with
Dan Albertce369362014-08-11 15:12:46 +0000119 clang.
120 </p>
Howard Hinnantc51e1022010-05-11 19:42:16 +0000121
Dan Albertce369362014-08-11 15:12:46 +0000122 <ul>
123 <li>Mac OS X i386</li>
124 <li>Mac OS X x86_64</li>
125 <li>FreeBSD 10+ i386</li>
126 <li>FreeBSD 10+ x86_64</li>
127 <li>FreeBSD 10+ ARM</li>
Sylvestre Ledru7e245372018-09-20 07:57:31 +0000128 <li>Linux i386</li>
129 <li>Linux x86_64</li>
Dan Albertce369362014-08-11 15:12:46 +0000130 </ul>
Howard Hinnantc51e1022010-05-11 19:42:16 +0000131
132 <!--=====================================================================-->
133 <h2 id="dir-structure">Current Status</h2>
134 <!--=====================================================================-->
135
Howard Hinnant09ce6822012-11-27 18:52:32 +0000136 <p>libc++ is a 100% complete C++11 implementation on Apple's OS X. </p>
Michael J. Spencera86f97e2012-12-31 19:34:21 +0000137 <p>LLVM and Clang can self host in C++ and C++11 mode with libc++ on Linux.</p>
Marshall Clowb84b8522018-01-29 21:28:46 +0000138 <p>libc++ is also a 100% complete C++14 implementation. A list of new features and
139 changes for C++14 can be found <a href="cxx1y_status.html">here</a>.</p>
140 <p>libc++'s C++17 implementation is not yet complete. A list of features and changes
141 for C++17 can be found <a href="cxx1z_status.html">here</a>.</p>
Marshall Clow5ac35df2014-11-10 15:43:20 +0000142 <p>A list of features and changes for the next C++ standard, known here as
Marshall Clowa413f582017-07-16 23:59:23 +0000143 "C++2a" (probably to be C++20) can be found <a href="cxx2a_status.html">here</a>.</p>
Marshall Clowb84b8522018-01-29 21:28:46 +0000144 <p>Implementation of the post-C++14 Technical Specifications is in progress. A list of features
145 and the current status of these features can be found <a href="ts1z_status.html">here</a>.</p>
146 <p>As features get moved from the Technical Specifications into the main standard, we
147 will (after a period for migration) remove them from the TS implementation. This
148 process is detailed <a href="TS_deprecation.html">here</a>.</p>
Howard Hinnant2347d2f2011-09-28 15:44:39 +0000149
Eric Fiselierdc770102014-08-18 05:25:04 +0000150 <!--======================================================================-->
Dan Albert66ddf1f2015-01-30 22:33:41 +0000151 <h2 id="buildbots">Build Bots</h2>
Eric Fiselierdc770102014-08-18 05:25:04 +0000152 <!--======================================================================-->
Eric Fiselierf4e7fc22014-12-09 22:53:21 +0000153 <p>The latest libc++ build results can be found at the following locations.</p>
Eric Fiselierdc770102014-08-18 05:25:04 +0000154 <ul>
Eric Fiselierf4e7fc22014-12-09 22:53:21 +0000155 <li><a href="http://lab.llvm.org:8011/console">
156 Buildbot libc++ builders
Eric Fiselierdc770102014-08-18 05:25:04 +0000157 </a></li>
Eric Fiselierf4e7fc22014-12-09 22:53:21 +0000158 <li><a href="http://lab.llvm.org:8080/green/view/Libcxx/">
159 Jenkins libc++ builders
Eric Fiselier7b7ef162014-10-16 02:48:59 +0000160 </a></li>
Eric Fiselierdc770102014-08-18 05:25:04 +0000161 </ul>
162
Howard Hinnantc51e1022010-05-11 19:42:16 +0000163 <!--=====================================================================-->
164 <h2>Get it and get involved!</h2>
165 <!--=====================================================================-->
Howard Hinnant3e1b0422010-08-22 01:04:38 +0000166
Howard Hinnantf0721aa2011-09-30 16:58:02 +0000167 <p>First please review our
Stephan T. Lavavej1e7fbda2017-08-31 17:59:42 +0000168 <a href="https://llvm.org/docs/DeveloperPolicy.html">Developer's Policy</a>.
Howard Hinnantf0721aa2011-09-30 16:58:02 +0000169
Eric Fiseliera0733922016-06-02 02:16:28 +0000170 The documentation for building and using libc++ can be found below.
171 <ul>
Stephan T. Lavavej1e7fbda2017-08-31 17:59:42 +0000172 <li><a href="https://libcxx.llvm.org/docs/UsingLibcxx.html">
Eric Fiseliera0733922016-06-02 02:16:28 +0000173 <b>Using libc++</b></a>
174 Documentation on using the library in your programs</li>
Stephan T. Lavavej1e7fbda2017-08-31 17:59:42 +0000175 <li><a href="https://libcxx.llvm.org/docs/BuildingLibcxx.html">
Eric Fiseliera0733922016-06-02 02:16:28 +0000176 <b>Building libc++</b></a>
177 Documentation on building the library using CMake</li>
Stephan T. Lavavej1e7fbda2017-08-31 17:59:42 +0000178 <li><a href="https://libcxx.llvm.org/docs/TestingLibcxx.html">
Eric Fiseliera0733922016-06-02 02:16:28 +0000179 <b>Testing libc++</b></a>
180 Documentation for developers wishing to test the library</li>
181 </ul>
Dan Albertce369362014-08-11 15:12:46 +0000182
183 <!--=====================================================================-->
Eric Fiselier24186c72015-05-12 22:55:30 +0000184 <h3>Notes and Known Issues</h3>
Dan Albertce369362014-08-11 15:12:46 +0000185 <!--=====================================================================-->
186
187 <p>
Eric Fiselier24186c72015-05-12 22:55:30 +0000188 <ul>
189 <li>
190 Building libc++ with <code>-fno-rtti</code> is not supported. However
191 linking against it with <code>-fno-rtti</code> is supported.
192 </li>
Eric Fiselier24186c72015-05-12 22:55:30 +0000193 </ul>
Dan Albertce369362014-08-11 15:12:46 +0000194 </p>
195
196 <p>Send discussions to the
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000197 <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libc++ mailing list</a>.</p>
Dan Albertce369362014-08-11 15:12:46 +0000198
199 <!--=====================================================================-->
Marshall Clowf7cc9a12014-04-03 03:13:12 +0000200 <h2>Bug reports and patches</h2>
201 <!--=====================================================================-->
202
Dan Albert66ddf1f2015-01-30 22:33:41 +0000203 <p>
204 If you think you've found a bug in libc++, please report it using
Stephan T. Lavavej9d889652017-08-31 17:59:46 +0000205 the <a href="https://bugs.llvm.org/">LLVM Bugzilla</a>. If you're not sure, you
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000206 can post a message to the <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libcxx-dev</a>
207 mailing list or on IRC.
Dan Albert66ddf1f2015-01-30 22:33:41 +0000208 </p>
Marshall Clowf7cc9a12014-04-03 03:13:12 +0000209
Dan Albert66ddf1f2015-01-30 22:33:41 +0000210 <p>
211 If you want to contribute a patch to libc++, the best place for that is
Stephan T. Lavavej1e7fbda2017-08-31 17:59:42 +0000212 <a href="https://llvm.org/docs/Phabricator.html">Phabricator</a>. Please
Eric Fiselierfa90b7f2018-09-22 19:49:29 +0000213 add libcxx-commits as a subscriber.
Dan Albert66ddf1f2015-01-30 22:33:41 +0000214 </p>
Marshall Clowf7cc9a12014-04-03 03:13:12 +0000215
216 <!--=====================================================================-->
Howard Hinnantbded6c92010-10-05 16:44:40 +0000217 <h2>Design Documents</h2>
218 <!--=====================================================================-->
219
220<ul>
221<li><a href="atomic_design.html"><tt>&lt;atomic&gt;</tt></a></li>
Howard Hinnante20b8de2010-11-19 01:38:58 +0000222<li><a href="type_traits_design.html"><tt>&lt;type_traits&gt;</tt></a></li>
Stephan T. Lavavej1e7fbda2017-08-31 17:59:42 +0000223<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>
Howard Hinnantbded6c92010-10-05 16:44:40 +0000224</ul>
225
Howard Hinnantc51e1022010-05-11 19:42:16 +0000226</div>
227</body>
Chris Lattnere66f1e32010-05-11 20:37:52 +0000228</html>