148fb7bfaSmrg<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" 248fb7bfaSmrg xml:id="manual.intro.using" xreflabel="Using"> 348fb7bfaSmrg <info><title>Using</title></info> 44fee23f9Smrg <?dbhtml filename="using.html"?> 54fee23f9Smrg 648fb7bfaSmrg <section xml:id="manual.intro.using.flags" xreflabel="Flags"><info><title>Command Options</title></info> 74fee23f9Smrg 84fee23f9Smrg <para> 94d5abbe8Smrg The set of features available in the GNU C++ library is shaped by 10*0a307195Smrg several <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc/Invoking-GCC.html">GCC 1148fb7bfaSmrg Command Options</link>. Options that impact libstdc++ are 124fee23f9Smrg enumerated and detailed in the table below. 134fee23f9Smrg </para> 144fee23f9Smrg 154fee23f9Smrg <para> 16f30ff588Smrg The standard library conforms to the dialect of C++ specified by the 17f30ff588Smrg <option>-std</option> option passed to the compiler. 18f30ff588Smrg By default, <command>g++</command> is equivalent to 19b1e83836Smrg <command>g++ -std=gnu++17</command> since GCC 11, and 20b1e83836Smrg <command>g++ -std=gnu++14</command> in GCC 6, 7, 8, 9, and 10, and 21f9a78e0eSmrg <command>g++ -std=gnu++98</command> for older releases. 224fee23f9Smrg </para> 234fee23f9Smrg 244d5abbe8Smrg <table frame="all" xml:id="table.cmd_options"> 254fee23f9Smrg<title>C++ Command Options</title> 2648fb7bfaSmrg 2748fb7bfaSmrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 2848fb7bfaSmrg<colspec colname="c1"/> 2948fb7bfaSmrg<colspec colname="c2"/> 304fee23f9Smrg 314fee23f9Smrg <thead> 324fee23f9Smrg <row> 334fee23f9Smrg <entry>Option Flags</entry> 344fee23f9Smrg <entry>Description</entry> 354fee23f9Smrg </row> 364fee23f9Smrg </thead> 374fee23f9Smrg 384fee23f9Smrg <tbody> 394fee23f9Smrg <row> 40*0a307195Smrg <entry><literal>-std</literal> 41f30ff588Smrg </entry> 42*0a307195Smrg <entry> 43*0a307195Smrg Select the C++ standard, and whether to use the base standard 44*0a307195Smrg or GNU dialect. 45f30ff588Smrg </entry> 46f30ff588Smrg </row> 47f30ff588Smrg 48f30ff588Smrg <row> 49b1e83836Smrg <entry> 50b1e83836Smrg <literal>-fno-exceptions</literal> 51b1e83836Smrg </entry> 524fee23f9Smrg <entry>See <link linkend="intro.using.exception.no">exception-free dialect</link></entry> 534fee23f9Smrg </row> 544fee23f9Smrg 554fee23f9Smrg <row> 56b1e83836Smrg <entry> 57b1e83836Smrg <literal>-fno-rtti</literal> 58b1e83836Smrg </entry> 594fee23f9Smrg <entry>As above, but RTTI-free dialect.</entry> 604fee23f9Smrg </row> 614fee23f9Smrg 624fee23f9Smrg <row> 63b17d1066Smrg <entry><literal>-pthread</literal></entry> 644d5abbe8Smrg <entry>For ISO C++11 654d5abbe8Smrg <filename class="headerfile"><thread></filename>, 664d5abbe8Smrg <filename class="headerfile"><future></filename>, 674d5abbe8Smrg <filename class="headerfile"><mutex></filename>, 684d5abbe8Smrg or <filename class="headerfile"><condition_variable></filename>. 694d5abbe8Smrg </entry> 704d5abbe8Smrg </row> 714d5abbe8Smrg 724d5abbe8Smrg <row> 734d5abbe8Smrg <entry><literal>-latomic</literal></entry> 744d5abbe8Smrg <entry>Linking to <filename class="libraryfile">libatomic</filename> 754d5abbe8Smrg is required for some uses of ISO C++11 764d5abbe8Smrg <filename class="headerfile"><atomic></filename>. 774d5abbe8Smrg </entry> 784fee23f9Smrg </row> 794fee23f9Smrg 804fee23f9Smrg <row> 81f30ff588Smrg <entry><literal>-lstdc++fs</literal></entry> 82f30ff588Smrg <entry>Linking to <filename class="libraryfile">libstdc++fs</filename> 83f30ff588Smrg is required for use of the Filesystem library extensions in 84181254a7Smrg <filename class="headerfile"><experimental/filesystem></filename>. 85f30ff588Smrg </entry> 86f30ff588Smrg </row> 87f30ff588Smrg 88f30ff588Smrg <row> 89b1e83836Smrg <entry><literal>-lstdc++_libbacktrace</literal></entry> 90b1e83836Smrg <entry>Until C++23 support is non-experimental, linking to 91b1e83836Smrg <filename class="libraryfile">libstdc++_libbacktrace.a</filename> 92b1e83836Smrg is required for use of the C++23 type 93b1e83836Smrg <classname>std::stacktrace</classname> 94b1e83836Smrg and related types in 95b1e83836Smrg <filename class="headerfile"><stacktrace></filename>. 96b1e83836Smrg </entry> 97b1e83836Smrg </row> 98b1e83836Smrg 99b1e83836Smrg <row> 1004fee23f9Smrg <entry><literal>-fopenmp</literal></entry> 1014fee23f9Smrg <entry>For <link linkend="manual.ext.parallel_mode">parallel</link> mode.</entry> 1024fee23f9Smrg </row> 103181254a7Smrg 104181254a7Smrg <row> 105181254a7Smrg <entry><literal>-ltbb</literal></entry> 106181254a7Smrg <entry>Linking to tbb (Thread Building Blocks) is required for use of the 107181254a7Smrg Parallel Standard Algorithms and execution policies in 108181254a7Smrg <filename class="headerfile"><execution></filename>. 109181254a7Smrg </entry> 110181254a7Smrg </row> 111181254a7Smrg 1124fee23f9Smrg </tbody> 1134fee23f9Smrg 1144fee23f9Smrg</tgroup> 1154fee23f9Smrg</table> 1164fee23f9Smrg 11748fb7bfaSmrg </section> 1184fee23f9Smrg 11948fb7bfaSmrg <section xml:id="manual.intro.using.headers" xreflabel="Headers"><info><title>Headers</title></info> 1204fee23f9Smrg <?dbhtml filename="using_headers.html"?> 1214fee23f9Smrg 12248fb7bfaSmrg 12348fb7bfaSmrg <section xml:id="manual.intro.using.headers.all" xreflabel="Header Files"><info><title>Header Files</title></info> 12448fb7bfaSmrg 1254fee23f9Smrg 1264fee23f9Smrg <para> 1274fee23f9Smrg The C++ standard specifies the entire set of header files that 1284fee23f9Smrg must be available to all hosted implementations. Actually, the 12948fb7bfaSmrg word "files" is a misnomer, since the contents of the 1304fee23f9Smrg headers don't necessarily have to be in any kind of external 131d79abf08Smrg file. The only rule is that when one <code>#include</code>s a 1324fee23f9Smrg header, the contents of that header become available, no matter 1334fee23f9Smrg how. 1344fee23f9Smrg </para> 1354fee23f9Smrg 1364fee23f9Smrg <para> 1374fee23f9Smrg That said, in practice files are used. 1384fee23f9Smrg </para> 1394fee23f9Smrg 1404fee23f9Smrg <para> 1414fee23f9Smrg There are two main types of include files: header files related 1424fee23f9Smrg to a specific version of the ISO C++ standard (called Standard 143d79abf08Smrg Headers), and all others (TS, TR1, C++ ABI, and Extensions). 1444fee23f9Smrg </para> 1454fee23f9Smrg 1464fee23f9Smrg <para> 147d79abf08Smrg Multiple dialects of standard headers are supported, corresponding to 148d79abf08Smrg the 1998 standard as updated for 2003, the 2011 standard, the 2014 149d79abf08Smrg standard, and so on. 1504fee23f9Smrg </para> 1514fee23f9Smrg 1524fee23f9Smrg <para> 153d79abf08Smrg <xref linkend="table.cxx98_headers"/> and 154d79abf08Smrg <xref linkend="table.cxx98_cheaders"/> and 155d79abf08Smrg <xref linkend="table.cxx98_deprheaders"/> 156d79abf08Smrg show the C++98/03 include files. 157d79abf08Smrg These are available in the C++98 compilation mode, 158d79abf08Smrg i.e. <code>-std=c++98</code> or <code>-std=gnu++98</code>. 159d79abf08Smrg Unless specified otherwise below, they are also available in later modes 160d79abf08Smrg (C++11, C++14 etc). 1614fee23f9Smrg </para> 1624fee23f9Smrg 1634d5abbe8Smrg<table frame="all" xml:id="table.cxx98_headers"> 1644fee23f9Smrg<title>C++ 1998 Library Headers</title> 16548fb7bfaSmrg 16648fb7bfaSmrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 16748fb7bfaSmrg<colspec colname="c1"/> 16848fb7bfaSmrg<colspec colname="c2"/> 16948fb7bfaSmrg<colspec colname="c3"/> 17048fb7bfaSmrg<colspec colname="c4"/> 17148fb7bfaSmrg<colspec colname="c5"/> 1724fee23f9Smrg<tbody> 1734fee23f9Smrg<row> 1744fee23f9Smrg<entry><filename class="headerfile">algorithm</filename></entry> 1754fee23f9Smrg<entry><filename class="headerfile">bitset</filename></entry> 1764fee23f9Smrg<entry><filename class="headerfile">complex</filename></entry> 1774fee23f9Smrg<entry><filename class="headerfile">deque</filename></entry> 1784fee23f9Smrg<entry><filename class="headerfile">exception</filename></entry> 1794fee23f9Smrg</row> 1804fee23f9Smrg<row> 1814fee23f9Smrg<entry><filename class="headerfile">fstream</filename></entry> 1824fee23f9Smrg<entry><filename class="headerfile">functional</filename></entry> 1834fee23f9Smrg<entry><filename class="headerfile">iomanip</filename></entry> 1844fee23f9Smrg<entry><filename class="headerfile">ios</filename></entry> 1854fee23f9Smrg<entry><filename class="headerfile">iosfwd</filename></entry> 1864fee23f9Smrg</row> 1874fee23f9Smrg<row> 1884fee23f9Smrg<entry><filename class="headerfile">iostream</filename></entry> 1894fee23f9Smrg<entry><filename class="headerfile">istream</filename></entry> 1904fee23f9Smrg<entry><filename class="headerfile">iterator</filename></entry> 1914fee23f9Smrg<entry><filename class="headerfile">limits</filename></entry> 1924fee23f9Smrg<entry><filename class="headerfile">list</filename></entry> 1934fee23f9Smrg</row> 1944fee23f9Smrg<row> 1954fee23f9Smrg<entry><filename class="headerfile">locale</filename></entry> 1964fee23f9Smrg<entry><filename class="headerfile">map</filename></entry> 1974fee23f9Smrg<entry><filename class="headerfile">memory</filename></entry> 1984fee23f9Smrg<entry><filename class="headerfile">new</filename></entry> 1994fee23f9Smrg<entry><filename class="headerfile">numeric</filename></entry> 2004fee23f9Smrg</row> 2014fee23f9Smrg<row> 2024fee23f9Smrg<entry><filename class="headerfile">ostream</filename></entry> 2034fee23f9Smrg<entry><filename class="headerfile">queue</filename></entry> 2044fee23f9Smrg<entry><filename class="headerfile">set</filename></entry> 2054fee23f9Smrg<entry><filename class="headerfile">sstream</filename></entry> 2064fee23f9Smrg<entry><filename class="headerfile">stack</filename></entry> 2074fee23f9Smrg</row> 2084fee23f9Smrg<row> 2094fee23f9Smrg<entry><filename class="headerfile">stdexcept</filename></entry> 2104fee23f9Smrg<entry><filename class="headerfile">streambuf</filename></entry> 2114fee23f9Smrg<entry><filename class="headerfile">string</filename></entry> 2124fee23f9Smrg<entry><filename class="headerfile">utility</filename></entry> 2134fee23f9Smrg<entry><filename class="headerfile">typeinfo</filename></entry> 2144fee23f9Smrg</row> 2154fee23f9Smrg<row> 2164fee23f9Smrg<entry><filename class="headerfile">valarray</filename></entry> 2174fee23f9Smrg<entry><filename class="headerfile">vector</filename></entry> 218d79abf08Smrg<entry namest="c3" nameend="c5"/> 2194fee23f9Smrg</row> 2204fee23f9Smrg</tbody> 2214fee23f9Smrg</tgroup> 2224fee23f9Smrg</table> 2234fee23f9Smrg 22448fb7bfaSmrg<para/> 2254d5abbe8Smrg<table frame="all" xml:id="table.cxx98_cheaders"> 2264fee23f9Smrg<title>C++ 1998 Library Headers for C Library Facilities</title> 22748fb7bfaSmrg 22848fb7bfaSmrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 22948fb7bfaSmrg<colspec colname="c1"/> 23048fb7bfaSmrg<colspec colname="c2"/> 23148fb7bfaSmrg<colspec colname="c3"/> 23248fb7bfaSmrg<colspec colname="c4"/> 23348fb7bfaSmrg<colspec colname="c5"/> 2344fee23f9Smrg<tbody> 2354fee23f9Smrg<row> 2364fee23f9Smrg<entry><filename class="headerfile">cassert</filename></entry> 2374fee23f9Smrg<entry><filename class="headerfile">cerrno</filename></entry> 2384fee23f9Smrg<entry><filename class="headerfile">cctype</filename></entry> 2394fee23f9Smrg<entry><filename class="headerfile">cfloat</filename></entry> 2404fee23f9Smrg<entry><filename class="headerfile">ciso646</filename></entry> 2414fee23f9Smrg</row> 2424fee23f9Smrg<row> 2434fee23f9Smrg<entry><filename class="headerfile">climits</filename></entry> 2444fee23f9Smrg<entry><filename class="headerfile">clocale</filename></entry> 2454fee23f9Smrg<entry><filename class="headerfile">cmath</filename></entry> 2464fee23f9Smrg<entry><filename class="headerfile">csetjmp</filename></entry> 2474fee23f9Smrg<entry><filename class="headerfile">csignal</filename></entry> 2484fee23f9Smrg</row> 2494fee23f9Smrg<row> 2504fee23f9Smrg<entry><filename class="headerfile">cstdarg</filename></entry> 2514fee23f9Smrg<entry><filename class="headerfile">cstddef</filename></entry> 2524fee23f9Smrg<entry><filename class="headerfile">cstdio</filename></entry> 2534fee23f9Smrg<entry><filename class="headerfile">cstdlib</filename></entry> 2544fee23f9Smrg<entry><filename class="headerfile">cstring</filename></entry> 2554fee23f9Smrg</row> 2564fee23f9Smrg<row> 2574fee23f9Smrg<entry><filename class="headerfile">ctime</filename></entry> 2584fee23f9Smrg<entry><filename class="headerfile">cwchar</filename></entry> 2594fee23f9Smrg<entry><filename class="headerfile">cwctype</filename></entry> 260d79abf08Smrg<entry namest="c4" nameend="c5"/> 2614fee23f9Smrg</row> 2624fee23f9Smrg</tbody> 2634fee23f9Smrg</tgroup> 2644fee23f9Smrg</table> 2654fee23f9Smrg 2664fee23f9Smrg<para> 267d79abf08Smrg The following header is deprecated 268d79abf08Smrg and might be removed from a future C++ standard. 269d79abf08Smrg</para> 270d79abf08Smrg 271d79abf08Smrg<table frame="all" xml:id="table.cxx98_deprheaders"> 272d79abf08Smrg<title>C++ 1998 Deprecated Library Header</title> 273d79abf08Smrg 274d79abf08Smrg<tgroup cols="1" align="left" colsep="1" rowsep="1"> 275d79abf08Smrg<colspec colname="c1"/> 276d79abf08Smrg<tbody> 277d79abf08Smrg<row> 278d79abf08Smrg<entry><filename class="headerfile">strstream</filename></entry> 279d79abf08Smrg</row> 280d79abf08Smrg</tbody> 281d79abf08Smrg</tgroup> 282d79abf08Smrg</table> 283d79abf08Smrg 284d79abf08Smrg<para> 285d79abf08Smrg<xref linkend="table.cxx11_headers"/> and 286d79abf08Smrg<xref linkend="table.cxx11_cheaders"/> show the C++11 include files. 287d79abf08SmrgThese are available in C++11 compilation 28848fb7bfaSmrgmode, i.e. <literal>-std=c++11</literal> or <literal>-std=gnu++11</literal>. 289d79abf08SmrgIncluding these headers in C++98/03 mode may result in compilation errors. 290d79abf08SmrgUnless specified otherwise below, they are also available in later modes 291d79abf08Smrg(C++14 etc). 2924fee23f9Smrg</para> 2934fee23f9Smrg 29448fb7bfaSmrg<para/> 2954d5abbe8Smrg<table frame="all" xml:id="table.cxx11_headers"> 29648fb7bfaSmrg<title>C++ 2011 Library Headers</title> 29748fb7bfaSmrg 29848fb7bfaSmrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 29948fb7bfaSmrg<colspec colname="c1"/> 30048fb7bfaSmrg<colspec colname="c2"/> 30148fb7bfaSmrg<colspec colname="c3"/> 30248fb7bfaSmrg<colspec colname="c4"/> 30348fb7bfaSmrg<colspec colname="c5"/> 3044fee23f9Smrg<tbody> 3054fee23f9Smrg 3064fee23f9Smrg<row> 3074fee23f9Smrg<entry><filename class="headerfile">array</filename></entry> 308d79abf08Smrg<entry><filename class="headerfile">atomic</filename></entry> 3094fee23f9Smrg<entry><filename class="headerfile">chrono</filename></entry> 310d79abf08Smrg<entry><filename class="headerfile">codecvt</filename></entry> 3114fee23f9Smrg<entry><filename class="headerfile">condition_variable</filename></entry> 3124fee23f9Smrg</row> 3134fee23f9Smrg<row> 314d79abf08Smrg<entry><filename class="headerfile">forward_list</filename></entry> 3154fee23f9Smrg<entry><filename class="headerfile">future</filename></entry> 3164fee23f9Smrg<entry><filename class="headerfile">initalizer_list</filename></entry> 3174fee23f9Smrg<entry><filename class="headerfile">mutex</filename></entry> 3184fee23f9Smrg<entry><filename class="headerfile">random</filename></entry> 3194fee23f9Smrg</row> 3204fee23f9Smrg<row> 3214fee23f9Smrg<entry><filename class="headerfile">ratio</filename></entry> 3224fee23f9Smrg<entry><filename class="headerfile">regex</filename></entry> 323d79abf08Smrg<entry><filename class="headerfile">scoped_allocator</filename></entry> 3244fee23f9Smrg<entry><filename class="headerfile">system_error</filename></entry> 3254fee23f9Smrg<entry><filename class="headerfile">thread</filename></entry> 3264fee23f9Smrg</row> 3274fee23f9Smrg<row> 3284fee23f9Smrg<entry><filename class="headerfile">tuple</filename></entry> 329d79abf08Smrg<entry><filename class="headerfile">typeindex</filename></entry> 3304fee23f9Smrg<entry><filename class="headerfile">type_traits</filename></entry> 3314fee23f9Smrg<entry><filename class="headerfile">unordered_map</filename></entry> 3324fee23f9Smrg<entry><filename class="headerfile">unordered_set</filename></entry> 3334fee23f9Smrg</row> 3344fee23f9Smrg 3354fee23f9Smrg</tbody> 3364fee23f9Smrg</tgroup> 3374fee23f9Smrg</table> 3384fee23f9Smrg 33948fb7bfaSmrg<para/> 3404fee23f9Smrg 3414d5abbe8Smrg<table frame="all" xml:id="table.cxx11_cheaders"> 34248fb7bfaSmrg<title>C++ 2011 Library Headers for C Library Facilities</title> 34348fb7bfaSmrg 34448fb7bfaSmrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 34548fb7bfaSmrg<colspec colname="c1"/> 34648fb7bfaSmrg<colspec colname="c2"/> 34748fb7bfaSmrg<colspec colname="c3"/> 34848fb7bfaSmrg<colspec colname="c4"/> 34948fb7bfaSmrg<colspec colname="c5"/> 3504fee23f9Smrg<tbody> 3514fee23f9Smrg<row> 3524fee23f9Smrg<entry><filename class="headerfile">ccomplex</filename></entry> 3534fee23f9Smrg<entry><filename class="headerfile">cfenv</filename></entry> 3544fee23f9Smrg<entry><filename class="headerfile">cinttypes</filename></entry> 355d79abf08Smrg<entry><filename class="headerfile">cstdalign</filename></entry> 3564fee23f9Smrg<entry><filename class="headerfile">cstdbool</filename></entry> 3574fee23f9Smrg</row> 3584fee23f9Smrg<row> 3594fee23f9Smrg<entry><filename class="headerfile">cstdint</filename></entry> 360d79abf08Smrg<entry><filename class="headerfile">ctgmath</filename></entry> 361d79abf08Smrg<entry><filename class="headerfile">cuchar</filename></entry> 362d79abf08Smrg<entry namest="c4" nameend="c5"/> 363d79abf08Smrg</row> 364d79abf08Smrg</tbody> 365d79abf08Smrg</tgroup> 366d79abf08Smrg</table> 367d79abf08Smrg 368d79abf08Smrg<para> 369d79abf08Smrg<xref linkend="table.cxx14_headers"/> shows the C++14 include file. 370d79abf08SmrgThis is available in C++14 compilation 371d79abf08Smrgmode, i.e. <literal>-std=c++14</literal> or <literal>-std=gnu++14</literal>. 372d79abf08SmrgIncluding this header in C++98/03 mode or C++11 will not result in 373d79abf08Smrgcompilation errors, but will not define anything. 374d79abf08SmrgUnless specified otherwise below, it is also available in later modes 375d79abf08Smrg(C++17 etc). 376d79abf08Smrg</para> 377d79abf08Smrg 378d79abf08Smrg<para/> 379d79abf08Smrg<table frame="all" xml:id="table.cxx14_headers"> 380d79abf08Smrg<title>C++ 2014 Library Header</title> 381d79abf08Smrg 382d79abf08Smrg<tgroup cols="1" align="left" colsep="1" rowsep="1"> 383d79abf08Smrg<colspec colname="c1"/> 384d79abf08Smrg<tbody> 385d79abf08Smrg<row> 386d79abf08Smrg<entry><filename class="headerfile">shared_mutex</filename></entry> 387d79abf08Smrg</row> 388d79abf08Smrg</tbody> 389d79abf08Smrg</tgroup> 390d79abf08Smrg</table> 391d79abf08Smrg 392d79abf08Smrg<para> 393b17d1066Smrg<xref linkend="table.cxx17_headers"/> shows the C++17 include files. 394b17d1066SmrgThese are available in C++17 compilation 395b17d1066Smrgmode, i.e. <literal>-std=c++17</literal> or <literal>-std=gnu++17</literal>. 396b17d1066SmrgIncluding these headers in earlier modes will not result in 397b17d1066Smrgcompilation errors, but will not define anything. 398b17d1066SmrgUnless specified otherwise below, they are also available in later modes 399b17d1066Smrg(C++20 etc). 400b17d1066Smrg</para> 401b17d1066Smrg 402b17d1066Smrg<para/> 403b17d1066Smrg<table frame="all" xml:id="table.cxx17_headers"> 404b17d1066Smrg<title>C++ 2017 Library Headers</title> 405b17d1066Smrg 406a3e9eb18Smrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 407b17d1066Smrg<colspec colname="c1"/> 408b17d1066Smrg<colspec colname="c2"/> 409b17d1066Smrg<colspec colname="c3"/> 410b17d1066Smrg<colspec colname="c4"/> 411a3e9eb18Smrg<colspec colname="c5"/> 412b17d1066Smrg<tbody> 413b17d1066Smrg<row> 414b17d1066Smrg<entry><filename class="headerfile">any</filename></entry> 415a3e9eb18Smrg<entry><filename class="headerfile">charconv</filename></entry> 416181254a7Smrg<entry><filename class="headerfile">execution</filename></entry> 417a3e9eb18Smrg<entry><filename class="headerfile">filesystem</filename></entry> 418181254a7Smrg<entry><filename class="headerfile">memory_resource</filename></entry> 419a3e9eb18Smrg</row> 420a3e9eb18Smrg<row> 421181254a7Smrg<entry><filename class="headerfile">optional</filename></entry> 422181254a7Smrg<entry><filename class="headerfile">string_view</filename></entry> 423b17d1066Smrg<entry><filename class="headerfile">variant</filename></entry> 424181254a7Smrg<entry namest="c4" nameend="c5"/> 425b17d1066Smrg</row> 426b17d1066Smrg</tbody> 427b17d1066Smrg</tgroup> 428b17d1066Smrg</table> 429b17d1066Smrg 430181254a7Smrg<para> 431181254a7Smrg<xref linkend="table.cxx20_headers"/> 432181254a7Smrgshows the C++2a include files. 433181254a7SmrgThese are available in C++2a compilation 434181254a7Smrgmode, i.e. <literal>-std=c++2a</literal> or <literal>-std=gnu++2a</literal>. 435181254a7SmrgIncluding these headers in earlier modes will not result in 436181254a7Smrgcompilation errors, but will not define anything. 437181254a7Smrg<!-- 438181254a7SmrgUnless specified otherwise below, they are also available in later modes 439181254a7Smrg(C++23 etc). 440181254a7Smrg--> 441181254a7Smrg</para> 442181254a7Smrg 443181254a7Smrg<para/> 444181254a7Smrg<table frame="all" xml:id="table.cxx20_headers"> 445181254a7Smrg<title>C++ 2020 Library Headers</title> 446181254a7Smrg 447181254a7Smrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 448181254a7Smrg<colspec colname="c1"/> 449181254a7Smrg<colspec colname="c2"/> 450181254a7Smrg<!-- 451181254a7Smrg<colspec colname="c3"/> 452181254a7Smrg<colspec colname="c4"/> 453181254a7Smrg<colspec colname="c5"/> 454181254a7Smrg--> 455181254a7Smrg<tbody> 456181254a7Smrg<row> 457181254a7Smrg<entry><filename class="headerfile">bit</filename></entry> 458181254a7Smrg<entry><filename class="headerfile">version</filename></entry> 459181254a7Smrg</row> 460181254a7Smrg<!-- TODO compare, concepts, contract, span, syncstream --> 461181254a7Smrg</tbody> 462181254a7Smrg</tgroup> 463181254a7Smrg</table> 464181254a7Smrg 465181254a7Smrg<para> 466181254a7Smrg The following headers have been removed in the C++2a working draft. 467181254a7Smrg They are still available when using this implementation, but in future 468181254a7Smrg they might start to produce warnings or errors when included in C++2a mode. 469181254a7Smrg Programs that intend to be portable should not include them. 470181254a7Smrg</para> 471181254a7Smrg 472181254a7Smrg<table frame="all" xml:id="table.cxx20_deprheaders"> 473181254a7Smrg<title>C++ 2020 Obsolete Headers</title> 474181254a7Smrg 475181254a7Smrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 476181254a7Smrg<colspec colname="c1"/> 477181254a7Smrg<colspec colname="c2"/> 478181254a7Smrg<colspec colname="c3"/> 479181254a7Smrg<colspec colname="c4"/> 480181254a7Smrg<colspec colname="c5"/> 481181254a7Smrg<tbody> 482181254a7Smrg<row> 483181254a7Smrg<entry><filename class="headerfile">ccomplex</filename></entry> 484181254a7Smrg<entry><filename class="headerfile">ciso646</filename></entry> 485181254a7Smrg<entry><filename class="headerfile">cstdalign</filename></entry> 486181254a7Smrg<entry><filename class="headerfile">cstdbool</filename></entry> 487181254a7Smrg<entry><filename class="headerfile">ctgmath</filename></entry> 488181254a7Smrg</row> 489181254a7Smrg</tbody> 490181254a7Smrg</tgroup> 491181254a7Smrg</table> 492b17d1066Smrg 493b17d1066Smrg<para> 494d79abf08Smrg<xref linkend="table.filesystemts_headers"/>, 495d79abf08Smrgshows the additional include file define by the 496d79abf08SmrgFile System Technical Specification, ISO/IEC TS 18822. 497d79abf08SmrgThis is available in C++11 and later compilation modes. 498d79abf08SmrgIncluding this header in earlier modes will not result in 499d79abf08Smrgcompilation errors, but will not define anything. 500d79abf08Smrg</para> 501d79abf08Smrg 502d79abf08Smrg<para/> 503d79abf08Smrg<table frame="all" xml:id="table.filesystemts_headers"> 504d79abf08Smrg<title>File System TS Header</title> 505d79abf08Smrg 506d79abf08Smrg<tgroup cols="1" align="left" colsep="1" rowsep="1"> 507d79abf08Smrg<colspec colname="c1"/> 508d79abf08Smrg<tbody> 509d79abf08Smrg<row> 510d79abf08Smrg<entry><filename class="headerfile">experimental/filesystem</filename></entry> 511d79abf08Smrg</row> 512d79abf08Smrg</tbody> 513d79abf08Smrg</tgroup> 514d79abf08Smrg</table> 515d79abf08Smrg 516d79abf08Smrg 517d79abf08Smrg<para> 518d79abf08Smrg<xref linkend="table.libfundts_headers"/>, 519d79abf08Smrgshows the additional include files define by the C++ Extensions for 520d79abf08SmrgLibrary Fundamentals Technical Specification, ISO/IEC TS 19568. 521d79abf08SmrgThese are available in C++14 and later compilation modes. 522d79abf08SmrgIncluding these headers in earlier modes will not result in 523d79abf08Smrgcompilation errors, but will not define anything. 524d79abf08Smrg</para> 525d79abf08Smrg 526d79abf08Smrg<para/> 527d79abf08Smrg<table frame="all" xml:id="table.libfundts_headers"> 528d79abf08Smrg<title>Library Fundamentals TS Headers</title> 529d79abf08Smrg 530d79abf08Smrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 531d79abf08Smrg<colspec colname="c1"/> 532d79abf08Smrg<colspec colname="c2"/> 533d79abf08Smrg<colspec colname="c3"/> 534d79abf08Smrg<colspec colname="c4"/> 535d79abf08Smrg<colspec colname="c5"/> 536d79abf08Smrg<tbody> 537d79abf08Smrg<row> 538d79abf08Smrg<entry><filename class="headerfile">experimental/algorithm</filename></entry> 539d79abf08Smrg<entry><filename class="headerfile">experimental/any</filename></entry> 540d79abf08Smrg<entry><filename class="headerfile">experimental/array</filename></entry> 541d79abf08Smrg<entry><filename class="headerfile">experimental/chrono</filename></entry> 542d79abf08Smrg<entry><filename class="headerfile">experimental/deque</filename></entry> 5434fee23f9Smrg</row> 5444fee23f9Smrg<row> 545d79abf08Smrg<entry><filename class="headerfile">experimental/forward_list</filename></entry> 546d79abf08Smrg<entry><filename class="headerfile">experimental/functional</filename></entry> 547d79abf08Smrg<entry><filename class="headerfile">experimental/iterator</filename></entry> 548d79abf08Smrg<entry><filename class="headerfile">experimental/list</filename></entry> 549d79abf08Smrg<entry><filename class="headerfile">experimental/map</filename></entry> 550d79abf08Smrg</row> 551d79abf08Smrg<row> 552d79abf08Smrg<entry><filename class="headerfile">experimental/memory</filename></entry> 553d79abf08Smrg<entry><filename class="headerfile">experimental/memory_resource</filename></entry> 554d79abf08Smrg<entry><filename class="headerfile">experimental/numeric</filename></entry> 555d79abf08Smrg<entry><filename class="headerfile">experimental/optional</filename></entry> 556d79abf08Smrg<entry><filename class="headerfile">experimental/propagate_const</filename></entry> 557d79abf08Smrg</row> 558d79abf08Smrg<row> 559d79abf08Smrg<entry><filename class="headerfile">experimental/random</filename></entry> 560d79abf08Smrg<entry><filename class="headerfile">experimental/ratio</filename></entry> 561d79abf08Smrg<entry><filename class="headerfile">experimental/regex</filename></entry> 562d79abf08Smrg<entry><filename class="headerfile">experimental/set</filename></entry> 563b17d1066Smrg<entry><filename class="headerfile">experimental/source_location</filename></entry> 564d79abf08Smrg</row> 565d79abf08Smrg<row> 566b17d1066Smrg<entry><filename class="headerfile">experimental/string</filename></entry> 567d79abf08Smrg<entry><filename class="headerfile">experimental/string_view</filename></entry> 568d79abf08Smrg<entry><filename class="headerfile">experimental/system_error</filename></entry> 569d79abf08Smrg<entry><filename class="headerfile">experimental/tuple</filename></entry> 570d79abf08Smrg<entry><filename class="headerfile">experimental/type_traits</filename></entry> 571d79abf08Smrg</row> 572d79abf08Smrg<row> 573b17d1066Smrg<entry><filename class="headerfile">experimental/unordered_map</filename></entry> 574d79abf08Smrg<entry><filename class="headerfile">experimental/unordered_set</filename></entry> 575d79abf08Smrg<entry><filename class="headerfile">experimental/utility</filename></entry> 576d79abf08Smrg<entry><filename class="headerfile">experimental/vector</filename></entry> 577b17d1066Smrg<entry /> 5784fee23f9Smrg</row> 5794fee23f9Smrg</tbody> 5804fee23f9Smrg</tgroup> 5814fee23f9Smrg</table> 5824fee23f9Smrg 5834fee23f9Smrg 5844fee23f9Smrg<para> 5854fee23f9Smrg In addition, TR1 includes as: 5864fee23f9Smrg</para> 5874fee23f9Smrg 5884d5abbe8Smrg<table frame="all" xml:id="table.tr1_headers"> 5894fee23f9Smrg<title>C++ TR 1 Library Headers</title> 59048fb7bfaSmrg 59148fb7bfaSmrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 59248fb7bfaSmrg<colspec colname="c1"/> 59348fb7bfaSmrg<colspec colname="c2"/> 59448fb7bfaSmrg<colspec colname="c3"/> 59548fb7bfaSmrg<colspec colname="c4"/> 59648fb7bfaSmrg<colspec colname="c5"/> 5974fee23f9Smrg<tbody> 5984fee23f9Smrg 5994fee23f9Smrg<row> 6004fee23f9Smrg<entry><filename class="headerfile">tr1/array</filename></entry> 6014fee23f9Smrg<entry><filename class="headerfile">tr1/complex</filename></entry> 6024fee23f9Smrg<entry><filename class="headerfile">tr1/memory</filename></entry> 6034fee23f9Smrg<entry><filename class="headerfile">tr1/functional</filename></entry> 6044fee23f9Smrg<entry><filename class="headerfile">tr1/random</filename></entry> 6054fee23f9Smrg</row> 6064fee23f9Smrg<row> 6074fee23f9Smrg<entry><filename class="headerfile">tr1/regex</filename></entry> 6084fee23f9Smrg<entry><filename class="headerfile">tr1/tuple</filename></entry> 6094fee23f9Smrg<entry><filename class="headerfile">tr1/type_traits</filename></entry> 6104fee23f9Smrg<entry><filename class="headerfile">tr1/unordered_map</filename></entry> 6114fee23f9Smrg<entry><filename class="headerfile">tr1/unordered_set</filename></entry> 6124fee23f9Smrg</row> 6134fee23f9Smrg<row> 6144fee23f9Smrg<entry><filename class="headerfile">tr1/utility</filename></entry> 615d79abf08Smrg<entry namest="c2" nameend="c5"/> 6164fee23f9Smrg</row> 6174fee23f9Smrg 6184fee23f9Smrg</tbody> 6194fee23f9Smrg</tgroup> 6204fee23f9Smrg</table> 6214fee23f9Smrg 62248fb7bfaSmrg<para/> 6234fee23f9Smrg 6244fee23f9Smrg 6254d5abbe8Smrg<table frame="all" xml:id="table.tr1_cheaders"> 6264fee23f9Smrg<title>C++ TR 1 Library Headers for C Library Facilities</title> 62748fb7bfaSmrg 62848fb7bfaSmrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 62948fb7bfaSmrg<colspec colname="c1"/> 63048fb7bfaSmrg<colspec colname="c2"/> 63148fb7bfaSmrg<colspec colname="c3"/> 63248fb7bfaSmrg<colspec colname="c4"/> 63348fb7bfaSmrg<colspec colname="c5"/> 6344fee23f9Smrg<tbody> 6354fee23f9Smrg 6364fee23f9Smrg<row> 6374fee23f9Smrg<entry><filename class="headerfile">tr1/ccomplex</filename></entry> 6384fee23f9Smrg<entry><filename class="headerfile">tr1/cfenv</filename></entry> 6394fee23f9Smrg<entry><filename class="headerfile">tr1/cfloat</filename></entry> 6404fee23f9Smrg<entry><filename class="headerfile">tr1/cmath</filename></entry> 6414fee23f9Smrg<entry><filename class="headerfile">tr1/cinttypes</filename></entry> 6424fee23f9Smrg</row> 6434fee23f9Smrg<row> 6444fee23f9Smrg<entry><filename class="headerfile">tr1/climits</filename></entry> 6454fee23f9Smrg<entry><filename class="headerfile">tr1/cstdarg</filename></entry> 6464fee23f9Smrg<entry><filename class="headerfile">tr1/cstdbool</filename></entry> 6474fee23f9Smrg<entry><filename class="headerfile">tr1/cstdint</filename></entry> 6484fee23f9Smrg<entry><filename class="headerfile">tr1/cstdio</filename></entry> 6494fee23f9Smrg</row> 6504fee23f9Smrg<row> 6514fee23f9Smrg<entry><filename class="headerfile">tr1/cstdlib</filename></entry> 6524fee23f9Smrg<entry><filename class="headerfile">tr1/ctgmath</filename></entry> 6534fee23f9Smrg<entry><filename class="headerfile">tr1/ctime</filename></entry> 6544fee23f9Smrg<entry><filename class="headerfile">tr1/cwchar</filename></entry> 6554fee23f9Smrg<entry><filename class="headerfile">tr1/cwctype</filename></entry> 6564fee23f9Smrg</row> 6574fee23f9Smrg 6584fee23f9Smrg</tbody> 6594fee23f9Smrg</tgroup> 6604fee23f9Smrg</table> 6614fee23f9Smrg 6624fee23f9Smrg 6634fee23f9Smrg<para>Decimal floating-point arithmetic is available if the C++ 6644fee23f9Smrgcompiler supports scalar decimal floating-point types defined via 6654fee23f9Smrg<code>__attribute__((mode(SD|DD|LD)))</code>. 6664fee23f9Smrg</para> 6674fee23f9Smrg 6684d5abbe8Smrg<table frame="all" xml:id="table.decfp_headers"> 6694fee23f9Smrg<title>C++ TR 24733 Decimal Floating-Point Header</title> 67048fb7bfaSmrg 67148fb7bfaSmrg<tgroup cols="1" align="left" colsep="1" rowsep="1"> 67248fb7bfaSmrg<colspec colname="c1"/> 6734fee23f9Smrg<tbody> 6744fee23f9Smrg<row> 6754fee23f9Smrg<entry><filename class="headerfile">decimal/decimal</filename></entry> 6764fee23f9Smrg</row> 6774fee23f9Smrg</tbody> 6784fee23f9Smrg</tgroup> 6794fee23f9Smrg</table> 6804fee23f9Smrg 6814fee23f9Smrg<para> 6824fee23f9Smrg Also included are files for the C++ ABI interface: 6834fee23f9Smrg</para> 6844fee23f9Smrg 6854d5abbe8Smrg<table frame="all" xml:id="table.abi_headers"> 6864fee23f9Smrg<title>C++ ABI Headers</title> 68748fb7bfaSmrg 68848fb7bfaSmrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 68948fb7bfaSmrg<colspec colname="c1"/> 69048fb7bfaSmrg<colspec colname="c2"/> 6914fee23f9Smrg<tbody> 6924fee23f9Smrg<row><entry><filename class="headerfile">cxxabi.h</filename></entry><entry><filename class="headerfile">cxxabi_forced.h</filename></entry></row> 6934fee23f9Smrg</tbody> 6944fee23f9Smrg</tgroup> 6954fee23f9Smrg</table> 6964fee23f9Smrg 6974fee23f9Smrg<para> 6984fee23f9Smrg And a large variety of extensions. 6994fee23f9Smrg</para> 7004fee23f9Smrg 7014d5abbe8Smrg<table frame="all" xml:id="table.ext_headers"> 7024fee23f9Smrg<title>Extension Headers</title> 70348fb7bfaSmrg 70448fb7bfaSmrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 70548fb7bfaSmrg<colspec colname="c1"/> 70648fb7bfaSmrg<colspec colname="c2"/> 70748fb7bfaSmrg<colspec colname="c3"/> 70848fb7bfaSmrg<colspec colname="c4"/> 70948fb7bfaSmrg<colspec colname="c5"/> 7104fee23f9Smrg<tbody> 7114fee23f9Smrg 7124fee23f9Smrg<row> 7134fee23f9Smrg<entry><filename class="headerfile">ext/algorithm</filename></entry> 7144fee23f9Smrg<entry><filename class="headerfile">ext/atomicity.h</filename></entry> 7154fee23f9Smrg<entry><filename class="headerfile">ext/bitmap_allocator.h</filename></entry> 7164fee23f9Smrg<entry><filename class="headerfile">ext/cast.h</filename></entry> 7174fee23f9Smrg</row> 7184fee23f9Smrg<row> 7194fee23f9Smrg<entry><filename class="headerfile">ext/codecvt_specializations.h</filename></entry> 7204fee23f9Smrg<entry><filename class="headerfile">ext/concurrence.h</filename></entry> 7214fee23f9Smrg<entry><filename class="headerfile">ext/debug_allocator.h</filename></entry> 7224fee23f9Smrg<entry><filename class="headerfile">ext/enc_filebuf.h</filename></entry> 7234fee23f9Smrg<entry><filename class="headerfile">ext/extptr_allocator.h</filename></entry> 7244fee23f9Smrg</row> 7254fee23f9Smrg<row> 7264fee23f9Smrg<entry><filename class="headerfile">ext/functional</filename></entry> 7274fee23f9Smrg<entry><filename class="headerfile">ext/iterator</filename></entry> 7284fee23f9Smrg<entry><filename class="headerfile">ext/malloc_allocator.h</filename></entry> 7294fee23f9Smrg<entry><filename class="headerfile">ext/memory</filename></entry> 7304fee23f9Smrg<entry><filename class="headerfile">ext/mt_allocator.h</filename></entry> 7314fee23f9Smrg</row> 7324fee23f9Smrg<row> 7334fee23f9Smrg<entry><filename class="headerfile">ext/new_allocator.h</filename></entry> 7344fee23f9Smrg<entry><filename class="headerfile">ext/numeric</filename></entry> 7354fee23f9Smrg<entry><filename class="headerfile">ext/numeric_traits.h</filename></entry> 7364fee23f9Smrg<entry><filename class="headerfile">ext/pb_ds/assoc_container.h</filename></entry> 7374fee23f9Smrg<entry><filename class="headerfile">ext/pb_ds/priority_queue.h</filename></entry> 7384fee23f9Smrg</row> 7394fee23f9Smrg<row> 7404fee23f9Smrg<entry><filename class="headerfile">ext/pod_char_traits.h</filename></entry> 7414fee23f9Smrg<entry><filename class="headerfile">ext/pool_allocator.h</filename></entry> 7424fee23f9Smrg<entry><filename class="headerfile">ext/rb_tree</filename></entry> 7434fee23f9Smrg<entry><filename class="headerfile">ext/rope</filename></entry> 7444fee23f9Smrg<entry><filename class="headerfile">ext/slist</filename></entry> 7454fee23f9Smrg</row> 7464fee23f9Smrg<row> 7474fee23f9Smrg<entry><filename class="headerfile">ext/stdio_filebuf.h</filename></entry> 7484fee23f9Smrg<entry><filename class="headerfile">ext/stdio_sync_filebuf.h</filename></entry> 7494fee23f9Smrg<entry><filename class="headerfile">ext/throw_allocator.h</filename></entry> 7504fee23f9Smrg<entry><filename class="headerfile">ext/typelist.h</filename></entry> 7514fee23f9Smrg<entry><filename class="headerfile">ext/type_traits.h</filename></entry> 7524fee23f9Smrg</row> 7534fee23f9Smrg<row> 7544fee23f9Smrg<entry><filename class="headerfile">ext/vstring.h</filename></entry> 755d79abf08Smrg<entry namest="c2" nameend="c5"/> 7564fee23f9Smrg</row> 7574fee23f9Smrg 7584fee23f9Smrg</tbody> 7594fee23f9Smrg</tgroup> 7604fee23f9Smrg</table> 7614fee23f9Smrg 76248fb7bfaSmrg<para/> 7634fee23f9Smrg 7644d5abbe8Smrg<table frame="all" xml:id="table.debug_headers"> 7654fee23f9Smrg<title>Extension Debug Headers</title> 76648fb7bfaSmrg 76748fb7bfaSmrg<tgroup cols="5" align="left" colsep="1" rowsep="1"> 76848fb7bfaSmrg<colspec colname="c1"/> 76948fb7bfaSmrg<colspec colname="c2"/> 77048fb7bfaSmrg<colspec colname="c3"/> 77148fb7bfaSmrg<colspec colname="c4"/> 77248fb7bfaSmrg<colspec colname="c5"/> 7734fee23f9Smrg<tbody> 7744fee23f9Smrg 7754fee23f9Smrg<row> 776d79abf08Smrg<entry><filename class="headerfile">debug/array</filename></entry> 7774fee23f9Smrg<entry><filename class="headerfile">debug/bitset</filename></entry> 7784fee23f9Smrg<entry><filename class="headerfile">debug/deque</filename></entry> 779d79abf08Smrg<entry><filename class="headerfile">debug/forward_list</filename></entry> 7804fee23f9Smrg<entry><filename class="headerfile">debug/list</filename></entry> 781d79abf08Smrg</row> 782d79abf08Smrg<row> 7834fee23f9Smrg<entry><filename class="headerfile">debug/map</filename></entry> 7844fee23f9Smrg<entry><filename class="headerfile">debug/set</filename></entry> 7854fee23f9Smrg<entry><filename class="headerfile">debug/string</filename></entry> 7864fee23f9Smrg<entry><filename class="headerfile">debug/unordered_map</filename></entry> 7874fee23f9Smrg<entry><filename class="headerfile">debug/unordered_set</filename></entry> 788d79abf08Smrg</row> 789d79abf08Smrg<row> 7904fee23f9Smrg<entry><filename class="headerfile">debug/vector</filename></entry> 791d79abf08Smrg<entry namest="c2" nameend="c5"/> 7924fee23f9Smrg</row> 7934fee23f9Smrg 7944fee23f9Smrg</tbody> 7954fee23f9Smrg</tgroup> 7964fee23f9Smrg</table> 7974fee23f9Smrg 79848fb7bfaSmrg<para/> 7994fee23f9Smrg 8004d5abbe8Smrg<table frame="all" xml:id="table.parallel_headers"> 8014fee23f9Smrg<title>Extension Parallel Headers</title> 80248fb7bfaSmrg 80348fb7bfaSmrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 80448fb7bfaSmrg<colspec colname="c1"/> 80548fb7bfaSmrg<colspec colname="c2"/> 8064fee23f9Smrg<tbody> 8074fee23f9Smrg<row> 8084fee23f9Smrg<entry><filename class="headerfile">parallel/algorithm</filename></entry> 8094fee23f9Smrg<entry><filename class="headerfile">parallel/numeric</filename></entry> 8104fee23f9Smrg</row> 8114fee23f9Smrg</tbody> 8124fee23f9Smrg</tgroup> 8134fee23f9Smrg</table> 8144fee23f9Smrg 81548fb7bfaSmrg </section> 8164fee23f9Smrg 81748fb7bfaSmrg <section xml:id="manual.intro.using.headers.mixing" xreflabel="Mixing Headers"><info><title>Mixing Headers</title></info> 81848fb7bfaSmrg 8194fee23f9Smrg 8204fee23f9Smrg<para> A few simple rules. 8214fee23f9Smrg</para> 8224fee23f9Smrg 8234fee23f9Smrg<para>First, mixing different dialects of the standard headers is not 8244fee23f9Smrgpossible. It's an all-or-nothing affair. Thus, code like 8254fee23f9Smrg</para> 8264fee23f9Smrg 8274fee23f9Smrg<programlisting> 8284fee23f9Smrg#include <array> 8294fee23f9Smrg#include <functional> 8304fee23f9Smrg</programlisting> 8314fee23f9Smrg 83248fb7bfaSmrg<para>Implies C++11 mode. To use the entities in <array>, the C++11 83348fb7bfaSmrgcompilation mode must be used, which implies the C++11 functionality 8344fee23f9Smrg(and deprecations) in <functional> will be present. 8354fee23f9Smrg</para> 8364fee23f9Smrg 8374fee23f9Smrg<para>Second, the other headers can be included with either dialect of 83848fb7bfaSmrgthe standard headers, although features and types specific to C++11 83948fb7bfaSmrgare still only enabled when in C++11 compilation mode. So, to use 8404fee23f9Smrgrvalue references with <code>__gnu_cxx::vstring</code>, or to use the 8414fee23f9Smrgdebug-mode versions of <code>std::unordered_map</code>, one must use 84248fb7bfaSmrgthe <code>std=gnu++11</code> compiler flag. (Or <code>std=c++11</code>, of course.) 8434fee23f9Smrg</para> 8444fee23f9Smrg 84548fb7bfaSmrg<para>A special case of the second rule is the mixing of TR1 and C++11 8464fee23f9Smrgfacilities. It is possible (although not especially prudent) to 84748fb7bfaSmrginclude both the TR1 version and the C++11 version of header in the 8484fee23f9Smrgsame translation unit: 8494fee23f9Smrg</para> 8504fee23f9Smrg 8514fee23f9Smrg<programlisting> 8524fee23f9Smrg#include <tr1/type_traits> 8534fee23f9Smrg#include <type_traits> 8544fee23f9Smrg</programlisting> 8554fee23f9Smrg 85648fb7bfaSmrg<para> Several parts of C++11 diverge quite substantially from TR1 predecessors. 8574fee23f9Smrg</para> 85848fb7bfaSmrg </section> 8594fee23f9Smrg 86048fb7bfaSmrg <section xml:id="manual.intro.using.headers.cheaders" xreflabel="C Headers and"><info><title>The C Headers and <code>namespace std</code></title></info> 86148fb7bfaSmrg 8624fee23f9Smrg 8634fee23f9Smrg<para> 8644fee23f9Smrg The standard specifies that if one includes the C-style header 8654fee23f9Smrg (<math.h> in this case), the symbols will be available 8664fee23f9Smrg in the global namespace and perhaps in 8674fee23f9Smrg namespace <code>std::</code> (but this is no longer a firm 8684fee23f9Smrg requirement.) On the other hand, including the C++-style 8694fee23f9Smrg header (<cmath>) guarantees that the entities will be 8704fee23f9Smrg found in namespace std and perhaps in the global namespace. 8714fee23f9Smrg </para> 8724fee23f9Smrg 8734fee23f9Smrg<para> 8744fee23f9SmrgUsage of C++-style headers is recommended, as then 8754fee23f9SmrgC-linkage names can be disambiguated by explicit qualification, such 8764fee23f9Smrgas by <code>std::abort</code>. In addition, the C++-style headers can 8774fee23f9Smrguse function overloading to provide a simpler interface to certain 8784fee23f9Smrgfamilies of C-functions. For instance in <cmath>, the 8794fee23f9Smrgfunction <code>std::sin</code> has overloads for all the builtin 8804fee23f9Smrgfloating-point types. This means that <code>std::sin</code> can be 8814fee23f9Smrgused uniformly, instead of a combination 8824fee23f9Smrgof <code>std::sinf</code>, <code>std::sin</code>, 8834fee23f9Smrgand <code>std::sinl</code>. 8844fee23f9Smrg</para> 88548fb7bfaSmrg </section> 8864fee23f9Smrg 88748fb7bfaSmrg <section xml:id="manual.intro.using.headers.pre" xreflabel="Precompiled Headers"><info><title>Precompiled Headers</title></info> 88848fb7bfaSmrg 8894fee23f9Smrg 8904fee23f9Smrg 8914fee23f9Smrg<para>There are three base header files that are provided. They can be 8924fee23f9Smrgused to precompile the standard headers and extensions into binary 893f30ff588Smrgfiles that may then be used to speed up compilations that use these headers. 8944fee23f9Smrg</para> 8954fee23f9Smrg 8964fee23f9Smrg 8974fee23f9Smrg<itemizedlist> 8984fee23f9Smrg<listitem> 8994fee23f9Smrg <para>stdc++.h</para> 9004fee23f9Smrg<para>Includes all standard headers. Actual content varies depending on 901f30ff588Smrg<link linkend="manual.intro.using.flags">language dialect</link>. 9024fee23f9Smrg</para> 9034fee23f9Smrg</listitem> 9044fee23f9Smrg 9054fee23f9Smrg<listitem> 9064fee23f9Smrg <para>stdtr1c++.h</para> 9074fee23f9Smrg<para>Includes all of <stdc++.h>, and adds all the TR1 headers. 9084fee23f9Smrg</para> 9094fee23f9Smrg</listitem> 9104fee23f9Smrg 9114fee23f9Smrg<listitem><para>extc++.h</para> 912f9a78e0eSmrg<para>Includes all of <stdc++.h>, and adds all the Extension headers 913f30ff588Smrg(and in C++98 mode also adds all the TR1 headers by including all of 914f30ff588Smrg<stdtr1c++.h>). 9154fee23f9Smrg</para></listitem> 9164fee23f9Smrg</itemizedlist> 9174fee23f9Smrg 918f30ff588Smrg<para>To construct a .gch file from one of these base header files, 919f30ff588Smrgfirst find the include directory for the compiler. One way to do 9204fee23f9Smrgthis is:</para> 9214fee23f9Smrg 9224fee23f9Smrg<programlisting> 9234fee23f9Smrgg++ -v hello.cc 9244fee23f9Smrg 9254fee23f9Smrg#include <...> search starts here: 9264fee23f9Smrg /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0 9274fee23f9Smrg... 9284fee23f9SmrgEnd of search list. 9294fee23f9Smrg</programlisting> 9304fee23f9Smrg 9314fee23f9Smrg 9324fee23f9Smrg<para>Then, create a precompiled header file with the same flags that 9334fee23f9Smrgwill be used to compile other projects.</para> 9344fee23f9Smrg 9354fee23f9Smrg<programlisting> 9364fee23f9Smrgg++ -Winvalid-pch -x c++-header -g -O2 -o ./stdc++.h.gch /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0/x86_64-unknown-linux-gnu/bits/stdc++.h 9374fee23f9Smrg</programlisting> 9384fee23f9Smrg 9394fee23f9Smrg<para>The resulting file will be quite large: the current size is around 9404fee23f9Smrgthirty megabytes. </para> 9414fee23f9Smrg 9424fee23f9Smrg<para>How to use the resulting file.</para> 9434fee23f9Smrg 9444fee23f9Smrg<programlisting> 9454fee23f9Smrgg++ -I. -include stdc++.h -H -g -O2 hello.cc 9464fee23f9Smrg</programlisting> 9474fee23f9Smrg 9484fee23f9Smrg<para>Verification that the PCH file is being used is easy:</para> 9494fee23f9Smrg 9504fee23f9Smrg<programlisting> 9514fee23f9Smrgg++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe 9524fee23f9Smrg! ./stdc++.h.gch 9534fee23f9Smrg. /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0/iostream 9544fee23f9Smrg. /mnt/share/bld/H-x86-gcc.20071201include/c++/4.3.0/string 9554fee23f9Smrg</programlisting> 9564fee23f9Smrg 95748fb7bfaSmrg<para>The exclamation point to the left of the <code>stdc++.h.gch</code> listing means that the generated PCH file was used.</para> 95848fb7bfaSmrg<para/> 9594fee23f9Smrg 96048fb7bfaSmrg<para> Detailed information about creating precompiled header files can be found in the GCC <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html">documentation</link>. 9614fee23f9Smrg</para> 9624fee23f9Smrg 96348fb7bfaSmrg </section> 96448fb7bfaSmrg </section> 9654fee23f9Smrg 9664fee23f9Smrg 96748fb7bfaSmrg <section xml:id="manual.intro.using.macros" xreflabel="Macros"><info><title>Macros</title></info> 9684fee23f9Smrg <?dbhtml filename="using_macros.html"?> 96948fb7bfaSmrg 9704fee23f9Smrg 9714fee23f9Smrg <para> 9724fee23f9Smrg All library macros begin with <code>_GLIBCXX_</code>. 9734fee23f9Smrg </para> 9744fee23f9Smrg 9754fee23f9Smrg <para> 9764fee23f9Smrg Furthermore, all pre-processor macros, switches, and 9774fee23f9Smrg configuration options are gathered in the 9784fee23f9Smrg file <filename class="headerfile">c++config.h</filename>, which 9794fee23f9Smrg is generated during the libstdc++ configuration and build 9804fee23f9Smrg process. This file is then included when needed by files part of 9814d5abbe8Smrg the public libstdc++ API, like 9824d5abbe8Smrg <filename class="headerfile"><ios></filename>. Most of these 9834d5abbe8Smrg macros should not be used by consumers of libstdc++, and are reserved 9844fee23f9Smrg for internal implementation use. <emphasis>These macros cannot 9854fee23f9Smrg be redefined</emphasis>. 9864fee23f9Smrg </para> 9874fee23f9Smrg 9884fee23f9Smrg <para> 9894fee23f9Smrg A select handful of macros control libstdc++ extensions and extra 9904fee23f9Smrg features, or provide versioning information for the API. Only 9914fee23f9Smrg those macros listed below are offered for consideration by the 9924fee23f9Smrg general public. 9934fee23f9Smrg </para> 9944fee23f9Smrg 995b17d1066Smrg <para>Below are the macros which users may check for library version 9964fee23f9Smrg information. </para> 9974fee23f9Smrg 9984fee23f9Smrg <variablelist> 9994fee23f9Smrg <varlistentry> 1000b17d1066Smrg <term><code>_GLIBCXX_RELEASE</code></term> 1001b17d1066Smrg <listitem> 1002b17d1066Smrg <para>The major release number for libstdc++. This macro is defined 1003b17d1066Smrg to the GCC major version that the libstdc++ headers belong to, 1004b17d1066Smrg as an integer constant. 1005b17d1066Smrg When compiling with GCC it has the same value as GCC's pre-defined 1006b17d1066Smrg macro <symbol>__GNUC__</symbol>. 1007b17d1066Smrg This macro can be used when libstdc++ is used with a non-GNU 1008b17d1066Smrg compiler where <symbol>__GNUC__</symbol> is not defined, or has a 1009b17d1066Smrg different value that doesn't correspond to the libstdc++ version. 1010b17d1066Smrg This macro first appeared in the GCC 7.1 release and is not defined 1011b17d1066Smrg for GCC 6.x or older releases. 1012b17d1066Smrg </para> 1013b17d1066Smrg </listitem> 1014b17d1066Smrg </varlistentry> 1015b17d1066Smrg <varlistentry> 10164fee23f9Smrg <term><code>__GLIBCXX__</code></term> 10174fee23f9Smrg <listitem> 1018b17d1066Smrg <para>The revision date of the libstdc++ source code, 1019b17d1066Smrg in compressed ISO date format, as an unsigned 1020b17d1066Smrg long. For notes about using this macro and details on the value of 1021b17d1066Smrg this macro for a particular release, please consult the 1022b17d1066Smrg <link linkend="abi.versioning.__GLIBCXX__">ABI History</link> 1023b17d1066Smrg appendix. 10244fee23f9Smrg </para> 10254fee23f9Smrg </listitem> 10264fee23f9Smrg </varlistentry> 10274fee23f9Smrg </variablelist> 10284fee23f9Smrg 10294fee23f9Smrg <para>Below are the macros which users may change with #define/#undef or 10304fee23f9Smrg with -D/-U compiler flags. The default state of the symbol is 10314fee23f9Smrg listed.</para> 10324fee23f9Smrg 10334fee23f9Smrg <para><quote>Configurable</quote> (or <quote>Not configurable</quote>) means 10344fee23f9Smrg that the symbol is initially chosen (or not) based on 10354fee23f9Smrg --enable/--disable options at library build and configure time 10364d5abbe8Smrg (documented in 10374d5abbe8Smrg <link linkend="manual.intro.setup.configure">Configure</link>), 10384d5abbe8Smrg with the various --enable/--disable choices being translated to 10394fee23f9Smrg #define/#undef). 10404fee23f9Smrg </para> 10414fee23f9Smrg 1042b1e83836Smrg <para> <acronym>ABI</acronym>-changing means that changing from the default value may 10434d5abbe8Smrg mean changing the <acronym>ABI</acronym> of compiled code. In other words, 10444d5abbe8Smrg these choices control code which has already been compiled (i.e., in a 10454fee23f9Smrg binary such as libstdc++.a/.so). If you explicitly #define or 10464fee23f9Smrg #undef these macros, the <emphasis>headers</emphasis> may see different code 10474fee23f9Smrg paths, but the <emphasis>libraries</emphasis> which you link against will not. 10484fee23f9Smrg Experimenting with different values with the expectation of 10494fee23f9Smrg consistent linkage requires changing the config headers before 10504fee23f9Smrg building/installing the library. 10514fee23f9Smrg </para> 10524fee23f9Smrg 10534fee23f9Smrg <variablelist> 105448fb7bfaSmrg <varlistentry><term><code>_GLIBCXX_USE_DEPRECATED</code></term> 10554fee23f9Smrg <listitem> 10564fee23f9Smrg <para> 1057b1e83836Smrg Defined to the value <literal>1</literal> by default. 1058b1e83836Smrg Not configurable. ABI-changing. Turning this off 10594fee23f9Smrg removes older ARM-style iostreams code, and other anachronisms 10604fee23f9Smrg from the API. This macro is dependent on the version of the 10614fee23f9Smrg standard being tracked, and as a result may give different results for 1062b1e83836Smrg different <code>-std</code> options. This may 10634fee23f9Smrg be useful in updating old C++ code which no longer meet the 10644fee23f9Smrg requirements of the language, or for checking current code 10654fee23f9Smrg against new language standards. 10664fee23f9Smrg </para> 10674fee23f9Smrg </listitem></varlistentry> 10684fee23f9Smrg 10694d5abbe8Smrg <varlistentry><term><code>_GLIBCXX_USE_CXX11_ABI</code></term> 10704d5abbe8Smrg <listitem> 10714d5abbe8Smrg <para> 10724d5abbe8Smrg Defined to the value <literal>1</literal> by default. 10734d5abbe8Smrg Configurable via <code>--disable-libstdcxx-dual-abi</code> 10744d5abbe8Smrg and/or <code>--with-default-libstdcxx-abi</code>. 10754d5abbe8Smrg ABI-changing. 10764d5abbe8Smrg When defined to a non-zero value the library headers will use the 10774d5abbe8Smrg new C++11-conforming ABI introduced in GCC 5, rather than the older 10784d5abbe8Smrg ABI introduced in GCC 3.4. This changes the definition of several 10794d5abbe8Smrg class templates, including <classname>std:string</classname>, 10804d5abbe8Smrg <classname>std::list</classname> and some locale facets. 10814d5abbe8Smrg For more details see <xref linkend="manual.intro.using.abi"/>. 10824d5abbe8Smrg </para> 10834d5abbe8Smrg </listitem></varlistentry> 10844d5abbe8Smrg 10854fee23f9Smrg <varlistentry><term><code>_GLIBCXX_CONCEPT_CHECKS</code></term> 10864fee23f9Smrg <listitem> 10874fee23f9Smrg <para> 10884fee23f9Smrg Undefined by default. Configurable via 10894fee23f9Smrg <code>--enable-concept-checks</code>. When defined, performs 10904fee23f9Smrg compile-time checking on certain template instantiations to 10914fee23f9Smrg detect violations of the requirements of the standard. This 1092f9a78e0eSmrg macro has no effect for freestanding implementations. 1093f9a78e0eSmrg This is described in more detail in 10944d5abbe8Smrg <link linkend="manual.ext.compile_checks">Compile Time Checks</link>. 10954fee23f9Smrg </para> 10964fee23f9Smrg </listitem></varlistentry> 10974fee23f9Smrg 1098f9a78e0eSmrg <varlistentry><term><code>_GLIBCXX_ASSERTIONS</code></term> 1099f9a78e0eSmrg <listitem> 1100f9a78e0eSmrg <para> 1101f9a78e0eSmrg Undefined by default. When defined, enables extra error checking in 1102f9a78e0eSmrg the form of precondition assertions, such as bounds checking in 1103f9a78e0eSmrg strings and null pointer checks when dereferencing smart pointers. 1104f9a78e0eSmrg </para> 1105f9a78e0eSmrg </listitem></varlistentry> 11064fee23f9Smrg <varlistentry><term><code>_GLIBCXX_DEBUG</code></term> 11074fee23f9Smrg <listitem> 11084fee23f9Smrg <para> 11094fee23f9Smrg Undefined by default. When defined, compiles user code using 11104fee23f9Smrg the <link linkend="manual.ext.debug_mode">debug mode</link>. 1111f9a78e0eSmrg When defined, <code>_GLIBCXX_ASSERTIONS</code> is defined 1112f9a78e0eSmrg automatically, so all the assertions enabled by that macro are also 1113f9a78e0eSmrg enabled in debug mode. 11144fee23f9Smrg </para> 11154fee23f9Smrg </listitem></varlistentry> 11164fee23f9Smrg <varlistentry><term><code>_GLIBCXX_DEBUG_PEDANTIC</code></term> 11174fee23f9Smrg <listitem> 11184fee23f9Smrg <para> 11194fee23f9Smrg Undefined by default. When defined while compiling with 11204fee23f9Smrg the <link linkend="manual.ext.debug_mode">debug mode</link>, makes 11214fee23f9Smrg the debug mode extremely picky by making the use of libstdc++ 11224fee23f9Smrg extensions and libstdc++-specific behavior into errors. 11234fee23f9Smrg </para> 11244fee23f9Smrg </listitem></varlistentry> 11254fee23f9Smrg <varlistentry><term><code>_GLIBCXX_PARALLEL</code></term> 11264fee23f9Smrg <listitem> 11274fee23f9Smrg <para>Undefined by default. When defined, compiles user code 11284fee23f9Smrg using the <link linkend="manual.ext.parallel_mode">parallel 11294fee23f9Smrg mode</link>. 11304fee23f9Smrg </para> 11314fee23f9Smrg </listitem></varlistentry> 1132f9a78e0eSmrg <varlistentry><term><code>_GLIBCXX_PARALLEL_ASSERTIONS</code></term> 1133f9a78e0eSmrg <listitem> 1134f9a78e0eSmrg <para>Undefined by default, but when any parallel mode header is included 1135f9a78e0eSmrg this macro will be defined to a non-zero value if 1136f9a78e0eSmrg <code>_GLIBCXX_ASSERTIONS</code> has a non-zero value, otherwise to zero. 1137f9a78e0eSmrg When defined to a non-zero value, it enables extra error checking and 1138f9a78e0eSmrg assertions in the parallel mode. 1139f9a78e0eSmrg </para> 1140f9a78e0eSmrg </listitem></varlistentry> 11414fee23f9Smrg 1142f9a78e0eSmrg <varlistentry><term><code>__STDCPP_WANT_MATH_SPEC_FUNCS__</code></term> 1143f9a78e0eSmrg <listitem> 1144f9a78e0eSmrg <para>Undefined by default. When defined to a non-zero integer constant, 1145f9a78e0eSmrg enables support for ISO/IEC 29124 Special Math Functions. 1146f9a78e0eSmrg </para> 1147f9a78e0eSmrg </listitem></varlistentry> 1148a3e9eb18Smrg 1149a3e9eb18Smrg <varlistentry><term><code>_GLIBCXX_SANITIZE_VECTOR</code></term> 1150a3e9eb18Smrg <listitem> 1151a3e9eb18Smrg <para> 1152a3e9eb18Smrg Undefined by default. When defined, <classname>std::vector</classname> 1153a3e9eb18Smrg operations will be annotated so that AddressSanitizer can detect 1154a3e9eb18Smrg invalid accesses to the unused capacity of a 1155a3e9eb18Smrg <classname>std::vector</classname>. These annotations are only 1156a3e9eb18Smrg enabled for 1157a3e9eb18Smrg <classname>std::vector<T, std::allocator<T>></classname> 1158a3e9eb18Smrg and only when <classname>std::allocator</classname> is derived from 1159181254a7Smrg <link linkend="allocator.ext"><classname>new_allocator</classname> 1160a3e9eb18Smrg or <classname>malloc_allocator</classname></link>. The annotations 1161a3e9eb18Smrg must be present on all vector operations or none, so this macro must 1162a3e9eb18Smrg be defined to the same value for all translation units that create, 1163a3e9eb18Smrg destroy or modify vectors. 1164a3e9eb18Smrg </para> 1165a3e9eb18Smrg </listitem></varlistentry> 11664fee23f9Smrg </variablelist> 11674fee23f9Smrg 116848fb7bfaSmrg </section> 11694fee23f9Smrg 11704d5abbe8Smrg<section xml:id="manual.intro.using.abi" xreflabel="Dual ABI"> 11714d5abbe8Smrg <info><title>Dual ABI</title></info> 11724d5abbe8Smrg <?dbhtml filename="using_dual_abi.html"?> 11734d5abbe8Smrg 11744d5abbe8Smrg<para> In the GCC 5.1 release libstdc++ introduced a new library ABI that 11754d5abbe8Smrg includes new implementations of <classname>std::string</classname> and 11764d5abbe8Smrg <classname>std::list</classname>. These changes were necessary to conform 11774d5abbe8Smrg to the 2011 C++ standard which forbids Copy-On-Write strings and requires 11784d5abbe8Smrg lists to keep track of their size. 11794d5abbe8Smrg</para> 11804d5abbe8Smrg 11814d5abbe8Smrg<para> In order to maintain backwards compatibility for existing code linked 11824d5abbe8Smrg to libstdc++ the library's soname has not changed and the old 11834d5abbe8Smrg implementations are still supported in parallel with the new ones. 11844d5abbe8Smrg This is achieved by defining the new implementations in an inline namespace 11854d5abbe8Smrg so they have different names for linkage purposes, e.g. the new version of 11864d5abbe8Smrg <classname>std::list<int></classname> is actually defined as 11874d5abbe8Smrg <classname>std::__cxx11::list<int></classname>. Because the symbols 11884d5abbe8Smrg for the new implementations have different names the definitions for both 11894d5abbe8Smrg versions can be present in the same library. 11904d5abbe8Smrg</para> 11914d5abbe8Smrg 11924d5abbe8Smrg<para> The <symbol>_GLIBCXX_USE_CXX11_ABI</symbol> macro (see 11934d5abbe8Smrg <xref linkend="manual.intro.using.macros"/>) controls whether 11944d5abbe8Smrg the declarations in the library headers use the old or new ABI. 11954d5abbe8Smrg So the decision of which ABI to use can be made separately for each 11964d5abbe8Smrg source file being compiled. 11974d5abbe8Smrg Using the default configuration options for GCC the default value 11984d5abbe8Smrg of the macro is <literal>1</literal> which causes the new ABI to be active, 11994d5abbe8Smrg so to use the old ABI you must explicitly define the macro to 12004d5abbe8Smrg <literal>0</literal> before including any library headers. 12014d5abbe8Smrg (Be aware that some GNU/Linux distributions configure GCC 5 differently so 12024d5abbe8Smrg that the default value of the macro is <literal>0</literal> and users must 12034d5abbe8Smrg define it to <literal>1</literal> to enable the new ABI.) 12044d5abbe8Smrg</para> 12054d5abbe8Smrg 12064d5abbe8Smrg<para> Although the changes were made for C++11 conformance, the choice of ABI 12074d5abbe8Smrg to use is independent of the <option>-std</option> option used to compile 12084d5abbe8Smrg your code, i.e. for a given GCC build the default value of the 12094d5abbe8Smrg <symbol>_GLIBCXX_USE_CXX11_ABI</symbol> macro is the same for all dialects. 12104d5abbe8Smrg This ensures that the <option>-std</option> does not change the ABI, so 12114d5abbe8Smrg that it is straightforward to link C++03 and C++11 code together. 12124d5abbe8Smrg</para> 12134d5abbe8Smrg 12144d5abbe8Smrg<para> Because <classname>std::string</classname> is used extensively 12154d5abbe8Smrg throughout the library a number of other types are also defined twice, 12164d5abbe8Smrg including the stringstream classes and several facets used by 12174d5abbe8Smrg <classname>std::locale</classname>. The standard facets which are always 12184d5abbe8Smrg installed in a locale may be present twice, with both ABIs, to ensure that 12194d5abbe8Smrg code like 12204d5abbe8Smrg <code>std::use_facet<std::time_get<char>>(locale);</code> 12214d5abbe8Smrg will work correctly for both <classname>std::time_get</classname> and 12224d5abbe8Smrg <classname>std::__cxx11::time_get</classname> (even if a user-defined 12234d5abbe8Smrg facet that derives from one or other version of 12244d5abbe8Smrg <classname>time_get</classname> is installed in the locale). 12254d5abbe8Smrg</para> 12264d5abbe8Smrg 12274d5abbe8Smrg<para> Although the standard exception types defined in 1228d79abf08Smrg <filename class="headerfile"><stdexcept></filename> use strings, most 12294d5abbe8Smrg are not defined twice, so that a <classname>std::out_of_range</classname> 12304d5abbe8Smrg exception thrown in one file can always be caught by a suitable handler in 12314d5abbe8Smrg another file, even if the two files are compiled with different ABIs. 12324d5abbe8Smrg</para> 12334d5abbe8Smrg 1234d79abf08Smrg<para> One exception type does change when using the new ABI, namely 1235d79abf08Smrg <classname>std::ios_base::failure</classname>. 1236d79abf08Smrg This is necessary because the 2011 standard changed its base class from 1237d79abf08Smrg <classname>std::exception</classname> to 1238d79abf08Smrg <classname>std::system_error</classname>, which causes its layout to change. 1239d79abf08Smrg Exceptions due to iostream errors are thrown by a function inside 1240d79abf08Smrg <filename class="libraryfile">libstdc++.so</filename>, so whether the thrown 1241d79abf08Smrg exception uses the old <classname>std::ios_base::failure</classname> type 1242d79abf08Smrg or the new one depends on the ABI that was active when 1243d79abf08Smrg <filename class="libraryfile">libstdc++.so</filename> was built, 1244d79abf08Smrg <emphasis>not</emphasis> the ABI active in the user code that is using 1245d79abf08Smrg iostreams. 1246d79abf08Smrg This means that for a given build of GCC the type thrown is fixed. 1247d79abf08Smrg In current releases the library throws a special type that can be caught 1248d79abf08Smrg by handlers for either the old or new type, 1249d79abf08Smrg but for GCC 7.1, 7.2 and 7.3 the library throws the new 1250d79abf08Smrg <classname>std::ios_base::failure</classname> type, 1251d79abf08Smrg and for GCC 5.x and 6.x the library throws the old type. 1252d79abf08Smrg Catch handlers of type <classname>std::ios_base::failure</classname> 1253d79abf08Smrg will only catch the exceptions if using a newer release, 1254d79abf08Smrg or if the handler is compiled with the same ABI as the type thrown by 1255d79abf08Smrg the library. 1256d79abf08Smrg Handlers for <classname>std::exception</classname> will always catch 1257d79abf08Smrg iostreams exceptions, because the old and new type both inherit from 1258d79abf08Smrg <classname>std::exception</classname>. 1259d79abf08Smrg</para> 1260d79abf08Smrg 12614d5abbe8Smrg<section xml:id="manual.intro.using.abi.trouble" xreflabel="Dual ABI Troubleshooting"><info><title>Troubleshooting</title></info> 12624d5abbe8Smrg 12634d5abbe8Smrg<para> If you get linker errors about undefined references to symbols 12644d5abbe8Smrg that involve types in the <code>std::__cxx11</code> namespace or the tag 12654d5abbe8Smrg <code>[abi:cxx11]</code> then it probably indicates that you are trying to 12664d5abbe8Smrg link together object files that were compiled with different values for the 12674d5abbe8Smrg <symbol>_GLIBCXX_USE_CXX11_ABI</symbol> macro. This commonly happens when 12684d5abbe8Smrg linking to a third-party library that was compiled with an older version 12694d5abbe8Smrg of GCC. If the third-party library cannot be rebuilt with the new ABI then 12704d5abbe8Smrg you will need to recompile your code with the old ABI. 12714d5abbe8Smrg</para> 12724d5abbe8Smrg 12734d5abbe8Smrg<para> Not all uses of the new ABI will cause changes in symbol names, for 12744d5abbe8Smrg example a class with a <classname>std::string</classname> member variable 12754d5abbe8Smrg will have the same mangled name whether compiled with the old or new ABI. 12764d5abbe8Smrg In order to detect such problems the new types and functions are 12774d5abbe8Smrg annotated with the <property>abi_tag</property> attribute, allowing the 12784d5abbe8Smrg compiler to warn about potential ABI incompatibilities in code using them. 12794d5abbe8Smrg Those warnings can be enabled with the <option>-Wabi-tag</option> option. 12804d5abbe8Smrg</para> 12814d5abbe8Smrg 12824d5abbe8Smrg</section> 12834d5abbe8Smrg</section> 12844d5abbe8Smrg 128548fb7bfaSmrg <section xml:id="manual.intro.using.namespaces" xreflabel="Namespaces"><info><title>Namespaces</title></info> 12864fee23f9Smrg <?dbhtml filename="using_namespaces.html"?> 12874fee23f9Smrg 128848fb7bfaSmrg 128948fb7bfaSmrg <section xml:id="manual.intro.using.namespaces.all" xreflabel="Available Namespaces"><info><title>Available Namespaces</title></info> 129048fb7bfaSmrg 12914fee23f9Smrg 12924fee23f9Smrg 12934fee23f9Smrg 12944fee23f9Smrg<para> There are three main namespaces. 12954fee23f9Smrg</para> 12964fee23f9Smrg 12974fee23f9Smrg<itemizedlist> 12984fee23f9Smrg <listitem><para>std</para> 12994fee23f9Smrg<para>The ISO C++ standards specify that "all library entities are defined 13004fee23f9Smrgwithin namespace std." This includes namespaces nested 1301f30ff588Smrgwithin namespace <code>std</code>, such as namespace 1302f30ff588Smrg<code>std::chrono</code>. 13034fee23f9Smrg</para> 13044fee23f9Smrg</listitem> 13054fee23f9Smrg<listitem><para>abi</para> 13064fee23f9Smrg<para>Specified by the C++ ABI. This ABI specifies a number of type and 13074fee23f9Smrgfunction APIs supplemental to those required by the ISO C++ Standard, 13084fee23f9Smrgbut necessary for interoperability. 13094fee23f9Smrg</para> 13104fee23f9Smrg</listitem> 13114fee23f9Smrg 13124fee23f9Smrg<listitem><para>__gnu_</para> 13134fee23f9Smrg<para>Indicating one of several GNU extensions. Choices 13144fee23f9Smrginclude <code>__gnu_cxx</code>, <code>__gnu_debug</code>, <code>__gnu_parallel</code>, 13154fee23f9Smrgand <code>__gnu_pbds</code>. 13164fee23f9Smrg</para></listitem> 13174fee23f9Smrg</itemizedlist> 13184fee23f9Smrg 13194d5abbe8Smrg<para> The library uses a number of inline namespaces as implementation 13204d5abbe8Smrgdetails that are not intended for users to refer to directly, these include 13214d5abbe8Smrg<code>std::__detail</code>, <code>std::__cxx11</code> and <code>std::_V2</code>. 13224d5abbe8Smrg</para> 13234d5abbe8Smrg 132448fb7bfaSmrg<para> A complete list of implementation namespaces (including namespace contents) is available in the generated source <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html">documentation</link>. 13254fee23f9Smrg</para> 13264fee23f9Smrg 13274fee23f9Smrg 132848fb7bfaSmrg </section> 13294fee23f9Smrg 133048fb7bfaSmrg <section xml:id="manual.intro.using.namespaces.std" xreflabel="namespace std"><info><title>namespace std</title></info> 133148fb7bfaSmrg 13324fee23f9Smrg 13334fee23f9Smrg 13344fee23f9Smrg<para> 13354fee23f9Smrg One standard requirement is that the library components are defined 13364fee23f9Smrg in <code>namespace std::</code>. Thus, in order to use these types or 13374fee23f9Smrg functions, one must do one of two things: 13384fee23f9Smrg</para> 13394fee23f9Smrg 13404fee23f9Smrg<itemizedlist> 13414fee23f9Smrg <listitem><para>put a kind of <emphasis>using-declaration</emphasis> in your source 13424fee23f9Smrg(either <code>using namespace std;</code> or i.e. <code>using 13434fee23f9Smrgstd::string;</code>) This approach works well for individual source files, but 13444fee23f9Smrgshould not be used in a global context, like header files. 13454fee23f9Smrg </para></listitem> <listitem><para>use a <emphasis>fully 13464fee23f9Smrgqualified name</emphasis> for each library symbol 13474fee23f9Smrg(i.e. <code>std::string</code>, <code>std::cout</code>) Always can be 13484fee23f9Smrgused, and usually enhanced, by strategic use of typedefs. (In the 13494fee23f9Smrgcases where the qualified verbiage becomes unwieldy.) 13504fee23f9Smrg </para> 13514fee23f9Smrg </listitem> 13524fee23f9Smrg</itemizedlist> 13534fee23f9Smrg 135448fb7bfaSmrg </section> 13554fee23f9Smrg 135648fb7bfaSmrg <section xml:id="manual.intro.using.namespaces.comp" xreflabel="Using Namespace Composition"><info><title>Using Namespace Composition</title></info> 135748fb7bfaSmrg 13584fee23f9Smrg 13594fee23f9Smrg<para> 13604fee23f9SmrgBest practice in programming suggests sequestering new data or 13614fee23f9Smrgfunctionality in a sanely-named, unique namespace whenever 13624fee23f9Smrgpossible. This is considered an advantage over dumping everything in 13634fee23f9Smrgthe global namespace, as then name look-up can be explicitly enabled or 13644fee23f9Smrgdisabled as above, symbols are consistently mangled without repetitive 13654fee23f9Smrgnaming prefixes or macros, etc. 13664fee23f9Smrg</para> 13674fee23f9Smrg 13684fee23f9Smrg<para>For instance, consider a project that defines most of its classes in <code>namespace gtk</code>. It is possible to 13694fee23f9Smrg adapt <code>namespace gtk</code> to <code>namespace std</code> by using a C++-feature called 13704fee23f9Smrg <emphasis>namespace composition</emphasis>. This is what happens if 13714fee23f9Smrg a <emphasis>using</emphasis>-declaration is put into a 13724fee23f9Smrg namespace-definition: the imported symbol(s) gets imported into the 13734fee23f9Smrg currently active namespace(s). For example: 13744fee23f9Smrg</para> 13754fee23f9Smrg<programlisting> 13764fee23f9Smrgnamespace gtk 13774fee23f9Smrg{ 13784fee23f9Smrg using std::string; 13794fee23f9Smrg using std::tr1::array; 13804fee23f9Smrg 13814fee23f9Smrg class Window { ... }; 13824fee23f9Smrg} 13834fee23f9Smrg</programlisting> 13844fee23f9Smrg<para> 13854fee23f9Smrg In this example, <code>std::string</code> gets imported into 13864fee23f9Smrg <code>namespace gtk</code>. The result is that use of 13874fee23f9Smrg <code>std::string</code> inside namespace gtk can just use <code>string</code>, without the explicit qualification. 13884fee23f9Smrg As an added bonus, 13894fee23f9Smrg <code>std::string</code> does not get imported into 13904fee23f9Smrg the global namespace. Additionally, a more elaborate arrangement can be made for backwards compatibility and portability, whereby the 13914fee23f9Smrg <code>using</code>-declarations can wrapped in macros that 139248fb7bfaSmrg are set based on autoconf-tests to either "" or i.e. <code>using 13934fee23f9Smrg std::string;</code> (depending on whether the system has 13944fee23f9Smrg libstdc++ in <code>std::</code> or not). (ideas from 13954fee23f9Smrg Llewelly and Karl Nelson) 13964fee23f9Smrg</para> 13974fee23f9Smrg 13984fee23f9Smrg 139948fb7bfaSmrg </section> 140048fb7bfaSmrg </section> 14014fee23f9Smrg 140248fb7bfaSmrg <section xml:id="manual.intro.using.linkage" xreflabel="Linkage"><info><title>Linking</title></info> 14034fee23f9Smrg <?dbhtml filename="using_dynamic_or_shared.html"?> 14044fee23f9Smrg 140548fb7bfaSmrg 140648fb7bfaSmrg <section xml:id="manual.intro.using.linkage.freestanding" xreflabel="Freestanding"><info><title>Almost Nothing</title></info> 140748fb7bfaSmrg 14084fee23f9Smrg <para> 14094fee23f9Smrg Or as close as it gets: freestanding. This is a minimal 14104fee23f9Smrg configuration, with only partial support for the standard 14114fee23f9Smrg library. Assume only the following header files can be used: 14124fee23f9Smrg </para> 14134fee23f9Smrg 14144fee23f9Smrg <itemizedlist> 14154fee23f9Smrg <listitem> 14164fee23f9Smrg <para> 14174fee23f9Smrg <filename class="headerfile">cstdarg</filename> 14184fee23f9Smrg </para> 14194fee23f9Smrg </listitem> 14204fee23f9Smrg 14214fee23f9Smrg <listitem> 14224fee23f9Smrg <para> 14234fee23f9Smrg <filename class="headerfile">cstddef</filename> 14244fee23f9Smrg </para> 14254fee23f9Smrg </listitem> 14264fee23f9Smrg 14274fee23f9Smrg <listitem> 14284fee23f9Smrg <para> 14294fee23f9Smrg <filename class="headerfile">cstdlib</filename> 14304fee23f9Smrg </para> 14314fee23f9Smrg </listitem> 14324fee23f9Smrg 14334fee23f9Smrg <listitem> 14344fee23f9Smrg <para> 14354fee23f9Smrg <filename class="headerfile">exception</filename> 14364fee23f9Smrg </para> 14374fee23f9Smrg </listitem> 14384fee23f9Smrg 14394fee23f9Smrg <listitem> 14404fee23f9Smrg <para> 14414fee23f9Smrg <filename class="headerfile">limits</filename> 14424fee23f9Smrg </para> 14434fee23f9Smrg </listitem> 14444fee23f9Smrg 14454fee23f9Smrg <listitem> 14464fee23f9Smrg <para> 14474fee23f9Smrg <filename class="headerfile">new</filename> 14484fee23f9Smrg </para> 14494fee23f9Smrg </listitem> 14504fee23f9Smrg 14514fee23f9Smrg <listitem> 14524fee23f9Smrg <para> 14534fee23f9Smrg <filename class="headerfile">exception</filename> 14544fee23f9Smrg </para> 14554fee23f9Smrg </listitem> 14564fee23f9Smrg 14574fee23f9Smrg <listitem> 14584fee23f9Smrg <para> 14594fee23f9Smrg <filename class="headerfile">typeinfo</filename> 14604fee23f9Smrg </para> 14614fee23f9Smrg </listitem> 14624fee23f9Smrg </itemizedlist> 14634fee23f9Smrg 14644fee23f9Smrg <para> 14654fee23f9Smrg In addition, throw in 14664fee23f9Smrg </para> 14674fee23f9Smrg 14684fee23f9Smrg <itemizedlist> 14694fee23f9Smrg <listitem> 14704fee23f9Smrg <para> 14714fee23f9Smrg <filename class="headerfile">cxxabi.h</filename>. 14724fee23f9Smrg </para> 14734fee23f9Smrg </listitem> 14744fee23f9Smrg </itemizedlist> 14754fee23f9Smrg 14764fee23f9Smrg <para> 14774fee23f9Smrg In the 147848fb7bfaSmrg C++11 <link linkend="manual.intro.using.flags">dialect</link> add 14794fee23f9Smrg </para> 14804fee23f9Smrg 14814fee23f9Smrg <itemizedlist> 14824fee23f9Smrg <listitem> 14834fee23f9Smrg <para> 14844fee23f9Smrg <filename class="headerfile">initializer_list</filename> 14854fee23f9Smrg </para> 14864fee23f9Smrg </listitem> 14874fee23f9Smrg <listitem> 14884fee23f9Smrg <para> 14894fee23f9Smrg <filename class="headerfile">type_traits</filename> 14904fee23f9Smrg </para> 14914fee23f9Smrg </listitem> 14924fee23f9Smrg </itemizedlist> 14934fee23f9Smrg 14944fee23f9Smrg <para> There exists a library that offers runtime support for 14954fee23f9Smrg just these headers, and it is called 14964fee23f9Smrg <filename class="libraryfile">libsupc++.a</filename>. To use it, compile with <command>gcc</command> instead of <command>g++</command>, like so: 14974fee23f9Smrg </para> 14984fee23f9Smrg 14994fee23f9Smrg <para> 15004fee23f9Smrg <command>gcc foo.cc -lsupc++</command> 15014fee23f9Smrg </para> 15024fee23f9Smrg 15034fee23f9Smrg <para> 15044fee23f9Smrg No attempt is made to verify that only the minimal subset 15054fee23f9Smrg identified above is actually used at compile time. Violations 15064fee23f9Smrg are diagnosed as undefined symbols at link time. 15074fee23f9Smrg </para> 150848fb7bfaSmrg </section> 15094fee23f9Smrg 151048fb7bfaSmrg <section xml:id="manual.intro.using.linkage.dynamic" xreflabel="Dynamic and Shared"><info><title>Finding Dynamic or Shared Libraries</title></info> 151148fb7bfaSmrg 15124fee23f9Smrg 15134fee23f9Smrg <para> 15144fee23f9Smrg If the only library built is the static library 15154fee23f9Smrg (<filename class="libraryfile">libstdc++.a</filename>), or if 15164fee23f9Smrg specifying static linking, this section is can be skipped. But 15174fee23f9Smrg if building or using a shared library 15184fee23f9Smrg (<filename class="libraryfile">libstdc++.so</filename>), then 15194fee23f9Smrg additional location information will need to be provided. 15204fee23f9Smrg </para> 15214fee23f9Smrg <para> 15224fee23f9Smrg But how? 15234fee23f9Smrg </para> 15244fee23f9Smrg <para> 15254fee23f9SmrgA quick read of the relevant part of the GCC 152648fb7bfaSmrg manual, <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html#Invoking-G_002b_002b">Compiling 152748fb7bfaSmrg C++ Programs</link>, specifies linking against a C++ 15284fee23f9Smrg library. More details from the 152948fb7bfaSmrg GCC <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/faq.html#rpath">FAQ</link>, 15304fee23f9Smrg which states <emphasis>GCC does not, by default, specify a 15314fee23f9Smrg location so that the dynamic linker can find dynamic libraries at 15324fee23f9Smrg runtime.</emphasis> 15334fee23f9Smrg </para> 15344fee23f9Smrg <para> 15354fee23f9Smrg Users will have to provide this information. 15364fee23f9Smrg </para> 15374fee23f9Smrg <para> 15384fee23f9Smrg Methods vary for different platforms and different styles, and 15394fee23f9Smrg are printed to the screen during installation. To summarize: 15404fee23f9Smrg </para> 15414fee23f9Smrg <itemizedlist> 15424fee23f9Smrg <listitem> 15434fee23f9Smrg <para> 15444fee23f9Smrg At runtime set <literal>LD_LIBRARY_PATH</literal> in your 15454fee23f9Smrg environment correctly, so that the shared library for 15464fee23f9Smrg libstdc++ can be found and loaded. Be certain that you 15474fee23f9Smrg understand all of the other implications and behavior 15484fee23f9Smrg of <literal>LD_LIBRARY_PATH</literal> first. 15494fee23f9Smrg </para> 15504fee23f9Smrg 15514fee23f9Smrg </listitem> 15524fee23f9Smrg <listitem> 15534fee23f9Smrg <para> 15544fee23f9Smrg Compile the path to find the library at runtime into the 15554fee23f9Smrg program. This can be done by passing certain options to 15564fee23f9Smrg <command>g++</command>, which will in turn pass them on to 15574fee23f9Smrg the linker. The exact format of the options is dependent on 15584fee23f9Smrg which linker you use: 15594fee23f9Smrg </para> 15604fee23f9Smrg <itemizedlist> 15614fee23f9Smrg <listitem> 15624fee23f9Smrg <para> 156348fb7bfaSmrg GNU ld (default on GNU/Linux): 156448fb7bfaSmrg <literal>-Wl,-rpath,</literal><filename class="directory">destdir/lib</filename> 15654fee23f9Smrg </para> 15664fee23f9Smrg </listitem> 15674fee23f9Smrg <listitem> 15684fee23f9Smrg <para> 156948fb7bfaSmrg Solaris ld: 157048fb7bfaSmrg <literal>-Wl,-R</literal><filename class="directory">destdir/lib</filename> 15714fee23f9Smrg </para> 15724fee23f9Smrg </listitem> 15734fee23f9Smrg </itemizedlist> 15744fee23f9Smrg </listitem> 157548fb7bfaSmrg <listitem> 157648fb7bfaSmrg <para> 157748fb7bfaSmrg Some linkers allow you to specify the path to the library by 157848fb7bfaSmrg setting <literal>LD_RUN_PATH</literal> in your environment 157948fb7bfaSmrg when linking. 158048fb7bfaSmrg </para> 158148fb7bfaSmrg </listitem> 158248fb7bfaSmrg <listitem> 158348fb7bfaSmrg <para> 158448fb7bfaSmrg On some platforms the system administrator can configure the 158548fb7bfaSmrg dynamic linker to always look for libraries in 158648fb7bfaSmrg <filename class="directory">destdir/lib</filename>, for example 158748fb7bfaSmrg by using the <command>ldconfig</command> utility on GNU/Linux 158848fb7bfaSmrg or the <command>crle</command> utility on Solaris. This is a 158948fb7bfaSmrg system-wide change which can make the system unusable so if you 159048fb7bfaSmrg are unsure then use one of the other methods described above. 159148fb7bfaSmrg </para> 159248fb7bfaSmrg </listitem> 15934fee23f9Smrg </itemizedlist> 15944fee23f9Smrg <para> 15954fee23f9Smrg Use the <command>ldd</command> utility on the linked executable 15964fee23f9Smrg to show 15974fee23f9Smrg which <filename class="libraryfile">libstdc++.so</filename> 15984fee23f9Smrg library the system will get at runtime. 15994fee23f9Smrg </para> 16004fee23f9Smrg <para> 16014fee23f9Smrg A <filename class="libraryfile">libstdc++.la</filename> file is 16024fee23f9Smrg also installed, for use with Libtool. If you use Libtool to 16034fee23f9Smrg create your executables, these details are taken care of for 16044fee23f9Smrg you. 16054fee23f9Smrg </para> 160648fb7bfaSmrg </section> 16074fee23f9Smrg 1608f30ff588Smrg <section xml:id="manual.intro.using.linkage.experimental" xreflabel="Library Extensions"><info><title>Experimental Library Extensions</title></info> 1609f30ff588Smrg 1610f30ff588Smrg <para> 1611f30ff588Smrg GCC 5.3 includes an implementation of the Filesystem library defined 1612f30ff588Smrg by the technical specification ISO/IEC TS 18822:2015. Because this is 1613f30ff588Smrg an experimental library extension, not part of the C++ standard, it 1614f30ff588Smrg is implemented in a separate library, 1615f30ff588Smrg <filename class="libraryfile">libstdc++fs.a</filename>, and there is 1616f30ff588Smrg no shared library for it. To use the library you should include 1617f30ff588Smrg <filename class="headerfile"><experimental/filesystem></filename> 1618f30ff588Smrg and link with <option>-lstdc++fs</option>. The library implementation 1619f30ff588Smrg is incomplete on non-POSIX platforms, specifically Windows support is 1620f30ff588Smrg rudimentary. 1621f30ff588Smrg </para> 1622f30ff588Smrg 1623f30ff588Smrg <para> 1624f30ff588Smrg Due to the experimental nature of the Filesystem library the usual 1625f30ff588Smrg guarantees about ABI stability and backwards compatibility do not apply 1626f30ff588Smrg to it. There is no guarantee that the components in any 1627f30ff588Smrg <filename class="headerfile"><experimental/xxx></filename> 1628f30ff588Smrg header will remain compatible between different GCC releases. 1629f30ff588Smrg </para> 1630f30ff588Smrg </section> 1631f30ff588Smrg </section> 16324fee23f9Smrg 163348fb7bfaSmrg <section xml:id="manual.intro.using.concurrency" xreflabel="Concurrency"><info><title>Concurrency</title></info> 16344fee23f9Smrg <?dbhtml filename="using_concurrency.html"?> 163548fb7bfaSmrg 16364fee23f9Smrg 16374fee23f9Smrg <para>This section discusses issues surrounding the proper compilation 16384fee23f9Smrg of multithreaded applications which use the Standard C++ 16394fee23f9Smrg library. This information is GCC-specific since the C++ 16404fee23f9Smrg standard does not address matters of multithreaded applications. 16414fee23f9Smrg </para> 16424fee23f9Smrg 164348fb7bfaSmrg <section xml:id="manual.intro.using.concurrency.prereq" xreflabel="Thread Prereq"><info><title>Prerequisites</title></info> 164448fb7bfaSmrg 16454fee23f9Smrg 16464fee23f9Smrg <para>All normal disclaimers aside, multithreaded C++ application are 16474fee23f9Smrg only supported when libstdc++ and all user code was built with 16484fee23f9Smrg compilers which report (via <code> gcc/g++ -v </code>) the same thread 16494fee23f9Smrg model and that model is not <emphasis>single</emphasis>. As long as your 16504fee23f9Smrg final application is actually single-threaded, then it should be 16514fee23f9Smrg safe to mix user code built with a thread model of 16524fee23f9Smrg <emphasis>single</emphasis> with a libstdc++ and other C++ libraries built 16534fee23f9Smrg with another thread model useful on the platform. Other mixes 16544fee23f9Smrg may or may not work but are not considered supported. (Thus, if 16554fee23f9Smrg you distribute a shared C++ library in binary form only, it may 16564fee23f9Smrg be best to compile it with a GCC configured with 16574fee23f9Smrg --enable-threads for maximal interchangeability and usefulness 16584fee23f9Smrg with a user population that may have built GCC with either 16594fee23f9Smrg --enable-threads or --disable-threads.) 16604fee23f9Smrg </para> 16614fee23f9Smrg <para>When you link a multithreaded application, you will probably 16624fee23f9Smrg need to add a library or flag to g++. This is a very 16634fee23f9Smrg non-standardized area of GCC across ports. Some ports support a 16644fee23f9Smrg special flag (the spelling isn't even standardized yet) to add 16654fee23f9Smrg all required macros to a compilation (if any such flags are 16664fee23f9Smrg required then you must provide the flag for all compilations not 16674fee23f9Smrg just linking) and link-library additions and/or replacements at 16684d5abbe8Smrg link time. The documentation is weak. On several targets (including 16694d5abbe8Smrg GNU/Linux, Solaris and various BSDs) -pthread is honored. 16704d5abbe8Smrg Some other ports use other switches. 16714d5abbe8Smrg This is not well documented anywhere other than 16724d5abbe8Smrg in "gcc -dumpspecs" (look at the 'lib' and 'cpp' entries). 16734d5abbe8Smrg </para> 16744d5abbe8Smrg 16754d5abbe8Smrg <para> 16764d5abbe8Smrg Some uses of <classname>std::atomic</classname> also require linking 16774d5abbe8Smrg to <filename class="libraryfile">libatomic</filename>. 16784fee23f9Smrg </para> 16794fee23f9Smrg 168048fb7bfaSmrg </section> 16814fee23f9Smrg 168248fb7bfaSmrg <section xml:id="manual.intro.using.concurrency.thread_safety" xreflabel="Thread Safety"><info><title>Thread Safety</title></info> 16834fee23f9Smrg 16844fee23f9Smrg 16854fee23f9Smrg<para> 168648fb7bfaSmrgIn the terms of the 2011 C++ standard a thread-safe program is one which 168748fb7bfaSmrgdoes not perform any conflicting non-atomic operations on memory locations 168848fb7bfaSmrgand so does not contain any data races. 168948fb7bfaSmrgThe standard places requirements on the library to ensure that no data 169048fb7bfaSmrgraces are caused by the library itself or by programs which use the 169148fb7bfaSmrglibrary correctly (as described below). 169248fb7bfaSmrgThe C++11 memory model and library requirements are a more formal version 1693a3e9eb18Smrgof the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html">SGI STL</link> definition of thread safety, which the library used 169448fb7bfaSmrgprior to the 2011 standard. 16954fee23f9Smrg</para> 16964fee23f9Smrg 16974fee23f9Smrg 16984fee23f9Smrg <para>The library strives to be thread-safe when all of the following 16994fee23f9Smrg conditions are met: 17004fee23f9Smrg </para> 17014fee23f9Smrg <itemizedlist> 17024fee23f9Smrg <listitem> 17034fee23f9Smrg <para>The system's libc is itself thread-safe, 17044fee23f9Smrg </para> 17054fee23f9Smrg </listitem> 17064fee23f9Smrg <listitem> 17074fee23f9Smrg <para> 17084fee23f9Smrg The compiler in use reports a thread model other than 17094fee23f9Smrg 'single'. This can be tested via output from <code>gcc 17104fee23f9Smrg -v</code>. Multi-thread capable versions of gcc output 17114fee23f9Smrg something like this: 17124fee23f9Smrg </para> 17134fee23f9Smrg<programlisting> 17144fee23f9Smrg%gcc -v 17154fee23f9SmrgUsing built-in specs. 17164fee23f9Smrg... 17174fee23f9SmrgThread model: posix 17184fee23f9Smrggcc version 4.1.2 20070925 (Red Hat 4.1.2-33) 17194fee23f9Smrg</programlisting> 17204fee23f9Smrg 17214fee23f9Smrg<para>Look for "Thread model" lines that aren't equal to "single."</para> 17224fee23f9Smrg </listitem> 17234fee23f9Smrg <listitem> 17244fee23f9Smrg <para> 17254fee23f9Smrg Requisite command-line flags are used for atomic operations 17264fee23f9Smrg and threading. Examples of this include <code>-pthread</code> 17274fee23f9Smrg and <code>-march=native</code>, although specifics vary 17284d5abbe8Smrg depending on the host environment. See 17294d5abbe8Smrg <link linkend="manual.intro.using.flags">Command Options</link> and 17304d5abbe8Smrg <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html">Machine 173148fb7bfaSmrg Dependent Options</link>. 17324fee23f9Smrg </para> 17334fee23f9Smrg </listitem> 17344fee23f9Smrg <listitem> 17354fee23f9Smrg <para> 17364d5abbe8Smrg An implementation of the 17374d5abbe8Smrg <filename class="headerfile">atomicity.h</filename> functions 17384d5abbe8Smrg exists for the architecture in question. See the 17394d5abbe8Smrg <link linkend="internals.thread_safety">internals 17404d5abbe8Smrg documentation</link> for more details. 17414fee23f9Smrg </para> 17424fee23f9Smrg </listitem> 17434fee23f9Smrg 17444fee23f9Smrg </itemizedlist> 174548fb7bfaSmrg 174648fb7bfaSmrg <para>The user code must guard against concurrent function calls which 174748fb7bfaSmrg access any particular library object's state when one or more of 174848fb7bfaSmrg those accesses modifies the state. An object will be modified by 174948fb7bfaSmrg invoking a non-const member function on it or passing it as a 175048fb7bfaSmrg non-const argument to a library function. An object will not be 175148fb7bfaSmrg modified by invoking a const member function on it or passing it to 175248fb7bfaSmrg a function as a pointer- or reference-to-const. 175348fb7bfaSmrg Typically, the application 175448fb7bfaSmrg programmer may infer what object locks must be held based on the 175548fb7bfaSmrg objects referenced in a function call and whether the objects are 175648fb7bfaSmrg accessed as const or non-const. Without getting 17574fee23f9Smrg into great detail, here is an example which requires user-level 17584fee23f9Smrg locks: 17594fee23f9Smrg </para> 17604fee23f9Smrg <programlisting> 17614fee23f9Smrg library_class_a shared_object_a; 17624fee23f9Smrg 176348fb7bfaSmrg void thread_main () { 17644fee23f9Smrg library_class_b *object_b = new library_class_b; 17654fee23f9Smrg shared_object_a.add_b (object_b); // must hold lock for shared_object_a 17664fee23f9Smrg shared_object_a.mutate (); // must hold lock for shared_object_a 17674fee23f9Smrg } 17684fee23f9Smrg 17694fee23f9Smrg // Multiple copies of thread_main() are started in independent threads.</programlisting> 17704fee23f9Smrg <para>Under the assumption that object_a and object_b are never exposed to 177148fb7bfaSmrg another thread, here is an example that does not require any 17724fee23f9Smrg user-level locks: 17734fee23f9Smrg </para> 17744fee23f9Smrg <programlisting> 177548fb7bfaSmrg void thread_main () { 17764fee23f9Smrg library_class_a object_a; 17774fee23f9Smrg library_class_b *object_b = new library_class_b; 17784fee23f9Smrg object_a.add_b (object_b); 17794fee23f9Smrg object_a.mutate (); 17804fee23f9Smrg } </programlisting> 178148fb7bfaSmrg 178248fb7bfaSmrg <para>All library types are safe to use in a multithreaded program 178348fb7bfaSmrg if objects are not shared between threads or as 178448fb7bfaSmrg long each thread carefully locks out access by any other 178548fb7bfaSmrg thread while it modifies any object visible to another thread. 178648fb7bfaSmrg Unless otherwise documented, the only exceptions to these rules 178748fb7bfaSmrg are atomic operations on the types in 178848fb7bfaSmrg <filename class="headerfile"><atomic></filename> 178948fb7bfaSmrg and lock/unlock operations on the standard mutex types in 179048fb7bfaSmrg <filename class="headerfile"><mutex></filename>. These 179148fb7bfaSmrg atomic operations allow concurrent accesses to the same object 179248fb7bfaSmrg without introducing data races. 17934fee23f9Smrg </para> 17944fee23f9Smrg 179548fb7bfaSmrg <para>The following member functions of standard containers can be 179648fb7bfaSmrg considered to be const for the purposes of avoiding data races: 179748fb7bfaSmrg <code>begin</code>, <code>end</code>, <code>rbegin</code>, <code>rend</code>, 179848fb7bfaSmrg <code>front</code>, <code>back</code>, <code>data</code>, 179948fb7bfaSmrg <code>find</code>, <code>lower_bound</code>, <code>upper_bound</code>, 180048fb7bfaSmrg <code>equal_range</code>, <code>at</code> 180148fb7bfaSmrg and, except in associative or unordered associative containers, 180248fb7bfaSmrg <code>operator[]</code>. In other words, although they are non-const 180348fb7bfaSmrg so that they can return mutable iterators, those member functions 180448fb7bfaSmrg will not modify the container. 180548fb7bfaSmrg Accessing an iterator might cause a non-modifying access to 180648fb7bfaSmrg the container the iterator refers to (for example incrementing a 180748fb7bfaSmrg list iterator must access the pointers between nodes, which are part 180848fb7bfaSmrg of the container and so conflict with other accesses to the container). 180948fb7bfaSmrg </para> 18104fee23f9Smrg 181148fb7bfaSmrg <para>Programs which follow the rules above will not encounter data 181248fb7bfaSmrg races in library code, even when using library types which share 181348fb7bfaSmrg state between distinct objects. In the example below the 181448fb7bfaSmrg <code>shared_ptr</code> objects share a reference count, but 181548fb7bfaSmrg because the code does not perform any non-const operations on the 181648fb7bfaSmrg globally-visible object, the library ensures that the reference 181748fb7bfaSmrg count updates are atomic and do not introduce data races: 181848fb7bfaSmrg </para> 181948fb7bfaSmrg <programlisting> 182048fb7bfaSmrg std::shared_ptr<int> global_sp; 182148fb7bfaSmrg 182248fb7bfaSmrg void thread_main() { 182348fb7bfaSmrg auto local_sp = global_sp; // OK, copy constructor's parameter is reference-to-const 182448fb7bfaSmrg 182548fb7bfaSmrg int i = *global_sp; // OK, operator* is const 182648fb7bfaSmrg int j = *local_sp; // OK, does not operate on global_sp 182748fb7bfaSmrg 182848fb7bfaSmrg // *global_sp = 2; // NOT OK, modifies int visible to other threads 182948fb7bfaSmrg // *local_sp = 2; // NOT OK, modifies int visible to other threads 183048fb7bfaSmrg 183148fb7bfaSmrg // global_sp.reset(); // NOT OK, reset is non-const 183248fb7bfaSmrg local_sp.reset(); // OK, does not operate on global_sp 183348fb7bfaSmrg } 183448fb7bfaSmrg 183548fb7bfaSmrg int main() { 183648fb7bfaSmrg global_sp.reset(new int(1)); 183748fb7bfaSmrg std::thread t1(thread_main); 183848fb7bfaSmrg std::thread t2(thread_main); 183948fb7bfaSmrg t1.join(); 184048fb7bfaSmrg t2.join(); 184148fb7bfaSmrg } 184248fb7bfaSmrg </programlisting> 184348fb7bfaSmrg 184448fb7bfaSmrg <para>For further details of the C++11 memory model see Hans-J. Boehm's 1845b17d1066Smrg <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.hboehm.info/c++mm/">Threads 1846fb8a8121Smrg and memory model for C++</link> pages, particularly the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.hboehm.info/c++mm/threadsintro.html">introduction</link> 1847b17d1066Smrg and <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.hboehm.info/c++mm/user-faq.html">FAQ</link>. 184848fb7bfaSmrg </para> 184948fb7bfaSmrg 185048fb7bfaSmrg </section> 185148fb7bfaSmrg <section xml:id="manual.intro.using.concurrency.atomics" xreflabel="Atomics"><info><title>Atomics</title></info> 185248fb7bfaSmrg 18534fee23f9Smrg <para> 18544fee23f9Smrg </para> 185548fb7bfaSmrg </section> 18564fee23f9Smrg 185748fb7bfaSmrg <section xml:id="manual.intro.using.concurrency.io" xreflabel="IO"><info><title>IO</title></info> 185848fb7bfaSmrg 18594fee23f9Smrg <para>This gets a bit tricky. Please read carefully, and bear with me. 18604fee23f9Smrg </para> 18614fee23f9Smrg 186248fb7bfaSmrg <section xml:id="concurrency.io.structure" xreflabel="Structure"><info><title>Structure</title></info> 186348fb7bfaSmrg 18644fee23f9Smrg <para>A wrapper 18654fee23f9Smrg type called <code>__basic_file</code> provides our abstraction layer 18664fee23f9Smrg for the <code>std::filebuf</code> classes. Nearly all decisions dealing 18674fee23f9Smrg with actual input and output must be made in <code>__basic_file</code>. 18684fee23f9Smrg </para> 18694fee23f9Smrg <para>A generic locking mechanism is somewhat in place at the filebuf layer, 18704fee23f9Smrg but is not used in the current code. Providing locking at any higher 18714fee23f9Smrg level is akin to providing locking within containers, and is not done 18724fee23f9Smrg for the same reasons (see the links above). 18734fee23f9Smrg </para> 187448fb7bfaSmrg </section> 18754fee23f9Smrg 187648fb7bfaSmrg <section xml:id="concurrency.io.defaults" xreflabel="Defaults"><info><title>Defaults</title></info> 187748fb7bfaSmrg 18784fee23f9Smrg <para>The __basic_file type is simply a collection of small wrappers around 18794fee23f9Smrg the C stdio layer (again, see the link under Structure). We do no 18804fee23f9Smrg locking ourselves, but simply pass through to calls to <code>fopen</code>, 18814fee23f9Smrg <code>fwrite</code>, and so forth. 18824fee23f9Smrg </para> 188348fb7bfaSmrg <para>So, for 3.0, the question of "is multithreading safe for I/O" 188448fb7bfaSmrg must be answered with, "is your platform's C library threadsafe 188548fb7bfaSmrg for I/O?" Some are by default, some are not; many offer multiple 18864fee23f9Smrg implementations of the C library with varying tradeoffs of threadsafety 18874fee23f9Smrg and efficiency. You, the programmer, are always required to take care 18884fee23f9Smrg with multiple threads. 18894fee23f9Smrg </para> 1890b17d1066Smrg <para>(As an example, the POSIX standard requires that C stdio 1891b17d1066Smrg <code>FILE*</code> operations are atomic. POSIX-conforming C libraries 1892b17d1066Smrg (e.g, on Solaris and GNU/Linux) have an internal mutex to serialize 1893b17d1066Smrg operations on <code>FILE*</code>s. 1894b17d1066Smrg However, you still need to not do stupid things like calling 18954fee23f9Smrg <code>fclose(fs)</code> in one thread followed by an access of 18964fee23f9Smrg <code>fs</code> in another.) 18974fee23f9Smrg </para> 18984fee23f9Smrg <para>So, if your platform's C library is threadsafe, then your 18994fee23f9Smrg <code>fstream</code> I/O operations will be threadsafe at the lowest 19004fee23f9Smrg level. For higher-level operations, such as manipulating the data 19014fee23f9Smrg contained in the stream formatting classes (e.g., setting up callbacks 19024fee23f9Smrg inside an <code>std::ofstream</code>), you need to guard such accesses 19034fee23f9Smrg like any other critical shared resource. 19044fee23f9Smrg </para> 190548fb7bfaSmrg </section> 19064fee23f9Smrg 190748fb7bfaSmrg <section xml:id="concurrency.io.future" xreflabel="Future"><info><title>Future</title></info> 190848fb7bfaSmrg 19094fee23f9Smrg <para> A 19104fee23f9Smrg second choice may be available for I/O implementations: libio. This is 19114fee23f9Smrg disabled by default, and in fact will not currently work due to other 19124fee23f9Smrg issues. It will be revisited, however. 19134fee23f9Smrg </para> 19144fee23f9Smrg <para>The libio code is a subset of the guts of the GNU libc (glibc) I/O 19154fee23f9Smrg implementation. When libio is in use, the <code>__basic_file</code> 19164fee23f9Smrg type is basically derived from FILE. (The real situation is more 19174fee23f9Smrg complex than that... it's derived from an internal type used to 19184fee23f9Smrg implement FILE. See libio/libioP.h to see scary things done with 191948fb7bfaSmrg vtbls.) The result is that there is no "layer" of C stdio 19204fee23f9Smrg to go through; the filebuf makes calls directly into the same 19214fee23f9Smrg functions used to implement <code>fread</code>, <code>fwrite</code>, 19224fee23f9Smrg and so forth, using internal data structures. (And when I say 192348fb7bfaSmrg "makes calls directly," I mean the function is literally 19244fee23f9Smrg replaced by a jump into an internal function. Fast but frightening. 19254fee23f9Smrg *grin*) 19264fee23f9Smrg </para> 19274fee23f9Smrg <para>Also, the libio internal locks are used. This requires pulling in 19284fee23f9Smrg large chunks of glibc, such as a pthreads implementation, and is one 19294fee23f9Smrg of the issues preventing widespread use of libio as the libstdc++ 19304fee23f9Smrg cstdio implementation. 19314fee23f9Smrg </para> 19324fee23f9Smrg <para>But we plan to make this work, at least as an option if not a future 19334fee23f9Smrg default. Platforms running a copy of glibc with a recent-enough 19344fee23f9Smrg version will see calls from libstdc++ directly into the glibc already 19354fee23f9Smrg installed. For other platforms, a copy of the libio subsection will 19364fee23f9Smrg be built and included in libstdc++. 19374fee23f9Smrg </para> 193848fb7bfaSmrg </section> 19394fee23f9Smrg 194048fb7bfaSmrg <section xml:id="concurrency.io.alt" xreflabel="Alt"><info><title>Alternatives</title></info> 194148fb7bfaSmrg 19424fee23f9Smrg <para>Don't forget that other cstdio implementations are possible. You could 19434fee23f9Smrg easily write one to perform your own forms of locking, to solve your 194448fb7bfaSmrg "interesting" problems. 19454fee23f9Smrg </para> 194648fb7bfaSmrg </section> 19474fee23f9Smrg 194848fb7bfaSmrg </section> 19494fee23f9Smrg 195048fb7bfaSmrg <section xml:id="manual.intro.using.concurrency.containers" xreflabel="Containers"><info><title>Containers</title></info> 195148fb7bfaSmrg 19524fee23f9Smrg 19534fee23f9Smrg <para>This section discusses issues surrounding the design of 19544fee23f9Smrg multithreaded applications which use Standard C++ containers. 19554fee23f9Smrg All information in this section is current as of the gcc 3.0 19564fee23f9Smrg release and all later point releases. Although earlier gcc 19574fee23f9Smrg releases had a different approach to threading configuration and 19584fee23f9Smrg proper compilation, the basic code design rules presented here 19594fee23f9Smrg were similar. For information on all other aspects of 19604fee23f9Smrg multithreading as it relates to libstdc++, including details on 19614fee23f9Smrg the proper compilation of threaded code (and compatibility between 19624fee23f9Smrg threaded and non-threaded code), see Chapter 17. 19634fee23f9Smrg </para> 19644fee23f9Smrg <para>Two excellent pages to read when working with the Standard C++ 19654fee23f9Smrg containers and threads are 1966a3e9eb18Smrg <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html">SGI's 1967a3e9eb18Smrg https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html</link> and 1968a3e9eb18Smrg <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html">SGI's 1969a3e9eb18Smrg https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html</link>. 19704fee23f9Smrg </para> 19714fee23f9Smrg <para><emphasis>However, please ignore all discussions about the user-level 19724fee23f9Smrg configuration of the lock implementation inside the STL 19734fee23f9Smrg container-memory allocator on those pages. For the sake of this 19744fee23f9Smrg discussion, libstdc++ configures the SGI STL implementation, 19754fee23f9Smrg not you. This is quite different from how gcc pre-3.0 worked. 19764fee23f9Smrg In particular, past advice was for people using g++ to 19774fee23f9Smrg explicitly define _PTHREADS or other macros or port-specific 19784fee23f9Smrg compilation options on the command line to get a thread-safe 19794fee23f9Smrg STL. This is no longer required for any port and should no 19804fee23f9Smrg longer be done unless you really know what you are doing and 19814fee23f9Smrg assume all responsibility.</emphasis> 19824fee23f9Smrg </para> 19834fee23f9Smrg <para>Since the container implementation of libstdc++ uses the SGI 19844fee23f9Smrg code, we use the same definition of thread safety as SGI when 19854fee23f9Smrg discussing design. A key point that beginners may miss is the 19864fee23f9Smrg fourth major paragraph of the first page mentioned above 19874fee23f9Smrg (<emphasis>For most clients...</emphasis>), which points out that 19884fee23f9Smrg locking must nearly always be done outside the container, by 19894fee23f9Smrg client code (that'd be you, not us). There is a notable 19904fee23f9Smrg exceptions to this rule. Allocators called while a container or 19914fee23f9Smrg element is constructed uses an internal lock obtained and 19924fee23f9Smrg released solely within libstdc++ code (in fact, this is the 19934fee23f9Smrg reason STL requires any knowledge of the thread configuration). 19944fee23f9Smrg </para> 19954fee23f9Smrg <para>For implementing a container which does its own locking, it is 19964fee23f9Smrg trivial to provide a wrapper class which obtains the lock (as 19974fee23f9Smrg SGI suggests), performs the container operation, and then 19984fee23f9Smrg releases the lock. This could be templatized <emphasis>to a certain 19994fee23f9Smrg extent</emphasis>, on the underlying container and/or a locking 20004fee23f9Smrg mechanism. Trying to provide a catch-all general template 20014fee23f9Smrg solution would probably be more trouble than it's worth. 20024fee23f9Smrg </para> 20034fee23f9Smrg <para>The library implementation may be configured to use the 20044fee23f9Smrg high-speed caching memory allocator, which complicates thread 20054fee23f9Smrg safety issues. For all details about how to globally override 20064fee23f9Smrg this at application run-time 20074fee23f9Smrg see <link linkend="manual.intro.using.macros">here</link>. Also 20084fee23f9Smrg useful are details 20094fee23f9Smrg on <link linkend="std.util.memory.allocator">allocator</link> 20104fee23f9Smrg options and capabilities. 20114fee23f9Smrg </para> 20124fee23f9Smrg 201348fb7bfaSmrg </section> 201448fb7bfaSmrg</section> 20154fee23f9Smrg 20164fee23f9Smrg<!-- Section 0x : Exception policies, expectations, topics --> 201748fb7bfaSmrg<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml" href="using_exceptions.xml"> 20184fee23f9Smrg</xi:include> 20194fee23f9Smrg 20204fee23f9Smrg<!-- Section 0x : Debug --> 202148fb7bfaSmrg<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml" href="debug.xml"> 20224fee23f9Smrg</xi:include> 20234fee23f9Smrg 20244fee23f9Smrg</chapter> 2025