blob: 3724b8b43624910cdb1541dc6a41dd81ed547d37 [file] [log] [blame]
Howard Hinnant2807d4a2010-08-22 01:04:38 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
Howard Hinnant3e519522010-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. Lavavej69c2e132017-08-31 17:59:42 +000015 <a href="https://llvm.org/">LLVM Home</a>
Howard Hinnant3e519522010-05-11 19:42:16 +000016 </div>
Howard Hinnant2807d4a2010-08-22 01:04:38 +000017
Howard Hinnant3e519522010-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 Ledru8e5a0b12018-09-20 07:58:43 +000025 <a href="https://libcxxabi.llvm.org/">libc++abi</a>
Eric Fiselier0ef540b2018-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 Fiselier3c354912017-02-17 08:37:03 +000028 <a href="https://bugs.llvm.org/">Bug Reports</a>
Stephan T. Lavavej69c2e132017-08-31 17:59:42 +000029 <a href="https://llvm.org/svn/llvm-project/libcxx/trunk/">Browse SVN</a>
30 <a href="https://llvm.org/viewvc/llvm-project/libcxx/trunk/">Browse ViewVC</a>
Howard Hinnant3e519522010-05-11 19:42:16 +000031 </div>
32</div>
33
34<div id="content">
35 <!--*********************************************************************-->
36 <h1>"libc++" C++ Standard Library</h1>
37 <!--*********************************************************************-->
Howard Hinnant2807d4a2010-08-22 01:04:38 +000038
Sylvestre Ledru0296eea2018-09-20 07:57:31 +000039 <p>libc++ is an implementation of the C++ standard library, targeting
40 C++11, C++14 and above.</p>
Howard Hinnant3e519522010-05-11 19:42:16 +000041
Chris Lattner58dffe62010-11-16 21:40:19 +000042 <p>All of the code in libc++ is <a
Stephan T. Lavavej69c2e132017-08-31 17:59:42 +000043 href="https://llvm.org/docs/DeveloperPolicy.html#license">dual licensed</a>
Chris Lattner58dffe62010-11-16 21:40:19 +000044 under the MIT license and the UIUC License (a BSD-like license).</p>
Howard Hinnant2807d4a2010-08-22 01:04:38 +000045
Howard Hinnant3e519522010-05-11 19:42:16 +000046 <!--=====================================================================-->
Eric Fiselier9da4c8e2015-10-14 20:51:33 +000047 <h2>New Documentation Coming Soon!</h2>
48 <!--=====================================================================-->
49
50 <p> Looking for documentation on how to use, build and test libc++? If so
51 checkout the new libc++ documentation.</p>
52
Stephan T. Lavavej69c2e132017-08-31 17:59:42 +000053 <p><a href="https://libcxx.llvm.org/docs/">
Eric Fiselier9da4c8e2015-10-14 20:51:33 +000054 Click here for the new libc++ documentation.</a></p>
55
56 <!--=====================================================================-->
Howard Hinnant3e519522010-05-11 19:42:16 +000057 <h2 id="goals">Features and Goals</h2>
58 <!--=====================================================================-->
Howard Hinnant2807d4a2010-08-22 01:04:38 +000059
Howard Hinnant3e519522010-05-11 19:42:16 +000060 <ul>
Howard Hinnant51eb2ad2012-07-19 15:57:51 +000061 <li>Correctness as defined by the C++11 standard.</li>
Howard Hinnant3e519522010-05-11 19:42:16 +000062 <li>Fast execution.</li>
63 <li>Minimal memory use.</li>
64 <li>Fast compile times.</li>
65 <li>ABI compatibility with gcc's libstdc++ for some low-level features
66 such as exception objects, rtti and memory allocation.</li>
67 <li>Extensive unit tests.</li>
68 </ul>
69
70 <!--=====================================================================-->
Marshall Clow497d9d22012-11-14 16:31:15 +000071 <h2 id="why">Why a new C++ Standard Library for C++11?</h2>
Chris Lattner27de3d62010-05-12 22:21:15 +000072 <!--=====================================================================-->
Howard Hinnant2807d4a2010-08-22 01:04:38 +000073
Chris Lattner27de3d62010-05-12 22:21:15 +000074 <p>After its initial introduction, many people have asked "why start a new
75 library instead of contributing to an existing library?" (like Apache's
76 libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
77 reasons, but some of the major ones are:</p>
Howard Hinnant2807d4a2010-08-22 01:04:38 +000078
Chris Lattner27de3d62010-05-12 22:21:15 +000079 <ul>
80 <li><p>From years of experience (including having implemented the standard
81 library before), we've learned many things about implementing
82 the standard containers which require ABI breakage and fundamental changes
83 to how they are implemented. For example, it is generally accepted that
84 building std::string using the "short string optimization" instead of
85 using Copy On Write (COW) is a superior approach for multicore
Marshall Clow497d9d22012-11-14 16:31:15 +000086 machines (particularly in C++11, which has rvalue references). Breaking
Chris Lattnerf005e8d2010-05-12 22:30:22 +000087 ABI compatibility with old versions of the library was
Chris Lattner27de3d62010-05-12 22:21:15 +000088 determined to be critical to achieving the performance goals of
89 libc++.</p></li>
Howard Hinnant2807d4a2010-08-22 01:04:38 +000090
Chris Lattner27de3d62010-05-12 22:21:15 +000091 <li><p>Mainline libstdc++ has switched to GPL3, a license which the developers
92 of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
Marshall Clow497d9d22012-11-14 16:31:15 +000093 independently extended to support C++11, but this would be a fork of the
Chris Lattnera940b5b2010-05-12 22:33:00 +000094 codebase (which is often seen as worse for a project than starting a new
95 independent one). Another problem with libstdc++ is that it is tightly
96 integrated with G++ development, tending to be tied fairly closely to the
97 matching version of G++.</p>
Chris Lattner27de3d62010-05-12 22:21:15 +000098 </li>
99
100 <li><p>STLport and the Apache libstdcxx library are two other popular
Marshall Clow497d9d22012-11-14 16:31:15 +0000101 candidates, but both lack C++11 support. Our experience (and the
Howard Hinnant51eb2ad2012-07-19 15:57:51 +0000102 experience of libstdc++ developers) is that adding support for C++11 (in
Chris Lattner27de3d62010-05-12 22:21:15 +0000103 particular rvalue references and move-only types) requires changes to
104 almost every class and function, essentially amounting to a rewrite.
Chris Lattnerd55fd112010-05-12 22:34:21 +0000105 Faced with a rewrite, we decided to start from scratch and evaluate every
106 design decision from first principles based on experience.</p>
Howard Hinnant2807d4a2010-08-22 01:04:38 +0000107
Chris Lattner27de3d62010-05-12 22:21:15 +0000108 <p>Further, both projects are apparently abandoned: STLport 5.2.1 was
109 released in Oct'08, and STDCXX 4.2.1 in May'08.</p>
110
111 </ul>
112
113 <!--=====================================================================-->
Howard Hinnant3e519522010-05-11 19:42:16 +0000114 <h2 id="requirements">Platform Support</h2>
115 <!--=====================================================================-->
116
Dan Albertec4de782014-08-11 15:12:46 +0000117 <p>
Sylvestre Ledru0296eea2018-09-20 07:57:31 +0000118 libc++ is known to work on the following platforms, using g++ and
119 clang. Note that functionality provided by &lt;atomic&gt; is only functional with
Dan Albertec4de782014-08-11 15:12:46 +0000120 clang.
121 </p>
Howard Hinnant3e519522010-05-11 19:42:16 +0000122
Dan Albertec4de782014-08-11 15:12:46 +0000123 <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>
Sylvestre Ledru0296eea2018-09-20 07:57:31 +0000129 <li>Linux i386</li>
130 <li>Linux x86_64</li>
Dan Albertec4de782014-08-11 15:12:46 +0000131 </ul>
Howard Hinnant3e519522010-05-11 19:42:16 +0000132
133 <!--=====================================================================-->
134 <h2 id="dir-structure">Current Status</h2>
135 <!--=====================================================================-->
136
Howard Hinnant6852b552012-11-27 18:52:32 +0000137 <p>libc++ is a 100% complete C++11 implementation on Apple's OS X. </p>
Michael J. Spencerbb8cfd02012-12-31 19:34:21 +0000138 <p>LLVM and Clang can self host in C++ and C++11 mode with libc++ on Linux.</p>
Marshall Clow6f73cf42018-01-29 21:28:46 +0000139 <p>libc++ is also a 100% complete C++14 implementation. A list of new features and
140 changes for C++14 can be found <a href="cxx1y_status.html">here</a>.</p>
141 <p>libc++'s C++17 implementation is not yet complete. A list of features and changes
142 for C++17 can be found <a href="cxx1z_status.html">here</a>.</p>
Marshall Clow68640682014-11-10 15:43:20 +0000143 <p>A list of features and changes for the next C++ standard, known here as
Marshall Clow5820ae42017-07-16 23:59:23 +0000144 "C++2a" (probably to be C++20) can be found <a href="cxx2a_status.html">here</a>.</p>
Marshall Clow6f73cf42018-01-29 21:28:46 +0000145 <p>Implementation of the post-C++14 Technical Specifications is in progress. A list of features
146 and the current status of these features can be found <a href="ts1z_status.html">here</a>.</p>
147 <p>As features get moved from the Technical Specifications into the main standard, we
148 will (after a period for migration) remove them from the TS implementation. This
149 process is detailed <a href="TS_deprecation.html">here</a>.</p>
Howard Hinnantd7aac282011-09-28 15:44:39 +0000150
Eric Fiseliercd6ac3a2014-08-18 05:25:04 +0000151 <!--======================================================================-->
Dan Albert2477bed2015-01-30 22:33:41 +0000152 <h2 id="buildbots">Build Bots</h2>
Eric Fiseliercd6ac3a2014-08-18 05:25:04 +0000153 <!--======================================================================-->
Eric Fiselierf60e4412014-12-09 22:53:21 +0000154 <p>The latest libc++ build results can be found at the following locations.</p>
Eric Fiseliercd6ac3a2014-08-18 05:25:04 +0000155 <ul>
Eric Fiselierf60e4412014-12-09 22:53:21 +0000156 <li><a href="http://lab.llvm.org:8011/console">
157 Buildbot libc++ builders
Eric Fiseliercd6ac3a2014-08-18 05:25:04 +0000158 </a></li>
Eric Fiselierf60e4412014-12-09 22:53:21 +0000159 <li><a href="http://lab.llvm.org:8080/green/view/Libcxx/">
160 Jenkins libc++ builders
Eric Fiselier8c5bc1c2014-10-16 02:48:59 +0000161 </a></li>
Eric Fiseliercd6ac3a2014-08-18 05:25:04 +0000162 </ul>
163
Howard Hinnant3e519522010-05-11 19:42:16 +0000164 <!--=====================================================================-->
165 <h2>Get it and get involved!</h2>
166 <!--=====================================================================-->
Howard Hinnant2807d4a2010-08-22 01:04:38 +0000167
Howard Hinnant4f4d3102011-09-30 16:58:02 +0000168 <p>First please review our
Stephan T. Lavavej69c2e132017-08-31 17:59:42 +0000169 <a href="https://llvm.org/docs/DeveloperPolicy.html">Developer's Policy</a>.
Howard Hinnant4f4d3102011-09-30 16:58:02 +0000170
Eric Fiseliere44604a2016-06-02 02:16:28 +0000171 The documentation for building and using libc++ can be found below.
172 <ul>
Stephan T. Lavavej69c2e132017-08-31 17:59:42 +0000173 <li><a href="https://libcxx.llvm.org/docs/UsingLibcxx.html">
Eric Fiseliere44604a2016-06-02 02:16:28 +0000174 <b>Using libc++</b></a>
175 Documentation on using the library in your programs</li>
Stephan T. Lavavej69c2e132017-08-31 17:59:42 +0000176 <li><a href="https://libcxx.llvm.org/docs/BuildingLibcxx.html">
Eric Fiseliere44604a2016-06-02 02:16:28 +0000177 <b>Building libc++</b></a>
178 Documentation on building the library using CMake</li>
Stephan T. Lavavej69c2e132017-08-31 17:59:42 +0000179 <li><a href="https://libcxx.llvm.org/docs/TestingLibcxx.html">
Eric Fiseliere44604a2016-06-02 02:16:28 +0000180 <b>Testing libc++</b></a>
181 Documentation for developers wishing to test the library</li>
182 </ul>
Dan Albertec4de782014-08-11 15:12:46 +0000183
184 <!--=====================================================================-->
Eric Fiselier9243c762015-05-12 22:55:30 +0000185 <h3>Notes and Known Issues</h3>
Dan Albertec4de782014-08-11 15:12:46 +0000186 <!--=====================================================================-->
187
188 <p>
Eric Fiselier9243c762015-05-12 22:55:30 +0000189 <ul>
190 <li>
191 Building libc++ with <code>-fno-rtti</code> is not supported. However
192 linking against it with <code>-fno-rtti</code> is supported.
193 </li>
194 <li>
195 On OS X v10.8 and older the CMake option
196 <code>-DLIBCXX_LIBCPPABI_VERSION=""</code> must be used during
197 configuration.
198 </li>
199 </ul>
Dan Albertec4de782014-08-11 15:12:46 +0000200 </p>
201
202 <p>Send discussions to the
Eric Fiselier0ef540b2018-09-22 19:49:29 +0000203 <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libc++ mailing list</a>.</p>
Dan Albertec4de782014-08-11 15:12:46 +0000204
205 <!--=====================================================================-->
Marshall Clow17c6aa02014-04-03 03:13:12 +0000206 <h2>Bug reports and patches</h2>
207 <!--=====================================================================-->
208
Dan Albert2477bed2015-01-30 22:33:41 +0000209 <p>
210 If you think you've found a bug in libc++, please report it using
Stephan T. Lavavej98fa5d42017-08-31 17:59:46 +0000211 the <a href="https://bugs.llvm.org/">LLVM Bugzilla</a>. If you're not sure, you
Eric Fiselier0ef540b2018-09-22 19:49:29 +0000212 can post a message to the <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libcxx-dev</a>
213 mailing list or on IRC.
Dan Albert2477bed2015-01-30 22:33:41 +0000214 </p>
Marshall Clow17c6aa02014-04-03 03:13:12 +0000215
Dan Albert2477bed2015-01-30 22:33:41 +0000216 <p>
217 If you want to contribute a patch to libc++, the best place for that is
Stephan T. Lavavej69c2e132017-08-31 17:59:42 +0000218 <a href="https://llvm.org/docs/Phabricator.html">Phabricator</a>. Please
Eric Fiselier0ef540b2018-09-22 19:49:29 +0000219 add libcxx-commits as a subscriber.
Dan Albert2477bed2015-01-30 22:33:41 +0000220 </p>
Marshall Clow17c6aa02014-04-03 03:13:12 +0000221
222 <!--=====================================================================-->
Howard Hinnant1de22662010-10-05 16:44:40 +0000223 <h2>Design Documents</h2>
224 <!--=====================================================================-->
225
226<ul>
227<li><a href="atomic_design.html"><tt>&lt;atomic&gt;</tt></a></li>
Howard Hinnant4b889672010-11-19 01:38:58 +0000228<li><a href="type_traits_design.html"><tt>&lt;type_traits&gt;</tt></a></li>
Stephan T. Lavavej69c2e132017-08-31 17:59:42 +0000229<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 Hinnant1de22662010-10-05 16:44:40 +0000230</ul>
231
Howard Hinnant3e519522010-05-11 19:42:16 +0000232</div>
233</body>
Chris Lattner6f12a7f2010-05-11 20:37:52 +0000234</html>