136ac495dSmrg<?xml version="1.0" encoding="UTF-8" standalone="no"?> 236ac495dSmrg<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Macros</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_headers.html" title="Headers" /><link rel="next" href="using_dual_abi.html" title="Dual ABI" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Macros</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_headers.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_dual_abi.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.macros"></a>Macros</h2></div></div></div><p> 336ac495dSmrg All library macros begin with <code class="code">_GLIBCXX_</code>. 436ac495dSmrg </p><p> 536ac495dSmrg Furthermore, all pre-processor macros, switches, and 636ac495dSmrg configuration options are gathered in the 736ac495dSmrg file <code class="filename">c++config.h</code>, which 836ac495dSmrg is generated during the libstdc++ configuration and build 936ac495dSmrg process. This file is then included when needed by files part of 1036ac495dSmrg the public libstdc++ API, like 1136ac495dSmrg <code class="filename"><ios></code>. Most of these 1236ac495dSmrg macros should not be used by consumers of libstdc++, and are reserved 1336ac495dSmrg for internal implementation use. <span class="emphasis"><em>These macros cannot 1436ac495dSmrg be redefined</em></span>. 1536ac495dSmrg </p><p> 1636ac495dSmrg A select handful of macros control libstdc++ extensions and extra 1736ac495dSmrg features, or provide versioning information for the API. Only 1836ac495dSmrg those macros listed below are offered for consideration by the 1936ac495dSmrg general public. 2036ac495dSmrg </p><p>Below are the macros which users may check for library version 2136ac495dSmrg information. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">_GLIBCXX_RELEASE</code></span></dt><dd><p>The major release number for libstdc++. This macro is defined 2236ac495dSmrg to the GCC major version that the libstdc++ headers belong to, 2336ac495dSmrg as an integer constant. 2436ac495dSmrg When compiling with GCC it has the same value as GCC's pre-defined 2536ac495dSmrg macro <span class="symbol">__GNUC__</span>. 2636ac495dSmrg This macro can be used when libstdc++ is used with a non-GNU 2736ac495dSmrg compiler where <span class="symbol">__GNUC__</span> is not defined, or has a 2836ac495dSmrg different value that doesn't correspond to the libstdc++ version. 2936ac495dSmrg This macro first appeared in the GCC 7.1 release and is not defined 3036ac495dSmrg for GCC 6.x or older releases. 3136ac495dSmrg </p></dd><dt><span class="term"><code class="code">__GLIBCXX__</code></span></dt><dd><p>The revision date of the libstdc++ source code, 3236ac495dSmrg in compressed ISO date format, as an unsigned 3336ac495dSmrg long. For notes about using this macro and details on the value of 3436ac495dSmrg this macro for a particular release, please consult the 3536ac495dSmrg <a class="link" href="abi.html#abi.versioning.__GLIBCXX__">ABI History</a> 3636ac495dSmrg appendix. 3736ac495dSmrg </p></dd></dl></div><p>Below are the macros which users may change with #define/#undef or 3836ac495dSmrg with -D/-U compiler flags. The default state of the symbol is 3936ac495dSmrg listed.</p><p><span class="quote">“<span class="quote">Configurable</span>”</span> (or <span class="quote">“<span class="quote">Not configurable</span>”</span>) means 4036ac495dSmrg that the symbol is initially chosen (or not) based on 4136ac495dSmrg --enable/--disable options at library build and configure time 4236ac495dSmrg (documented in 4336ac495dSmrg <a class="link" href="configure.html" title="Configure">Configure</a>), 4436ac495dSmrg with the various --enable/--disable choices being translated to 4536ac495dSmrg #define/#undef). 4636ac495dSmrg </p><p> <acronym class="acronym">ABI</acronym> means that changing from the default value may 4736ac495dSmrg mean changing the <acronym class="acronym">ABI</acronym> of compiled code. In other words, 4836ac495dSmrg these choices control code which has already been compiled (i.e., in a 4936ac495dSmrg binary such as libstdc++.a/.so). If you explicitly #define or 5036ac495dSmrg #undef these macros, the <span class="emphasis"><em>headers</em></span> may see different code 5136ac495dSmrg paths, but the <span class="emphasis"><em>libraries</em></span> which you link against will not. 5236ac495dSmrg Experimenting with different values with the expectation of 5336ac495dSmrg consistent linkage requires changing the config headers before 5436ac495dSmrg building/installing the library. 5536ac495dSmrg </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">_GLIBCXX_USE_DEPRECATED</code></span></dt><dd><p> 5636ac495dSmrg Defined by default. Not configurable. ABI-changing. Turning this off 5736ac495dSmrg removes older ARM-style iostreams code, and other anachronisms 5836ac495dSmrg from the API. This macro is dependent on the version of the 5936ac495dSmrg standard being tracked, and as a result may give different results for 6036ac495dSmrg <code class="code">-std=c++98</code> and <code class="code">-std=c++11</code>. This may 6136ac495dSmrg be useful in updating old C++ code which no longer meet the 6236ac495dSmrg requirements of the language, or for checking current code 6336ac495dSmrg against new language standards. 6436ac495dSmrg </p></dd><dt><span class="term"><code class="code">_GLIBCXX_USE_CXX11_ABI</code></span></dt><dd><p> 6536ac495dSmrg Defined to the value <code class="literal">1</code> by default. 6636ac495dSmrg Configurable via <code class="code">--disable-libstdcxx-dual-abi</code> 6736ac495dSmrg and/or <code class="code">--with-default-libstdcxx-abi</code>. 6836ac495dSmrg ABI-changing. 6936ac495dSmrg When defined to a non-zero value the library headers will use the 7036ac495dSmrg new C++11-conforming ABI introduced in GCC 5, rather than the older 7136ac495dSmrg ABI introduced in GCC 3.4. This changes the definition of several 7236ac495dSmrg class templates, including <code class="classname">std:string</code>, 7336ac495dSmrg <code class="classname">std::list</code> and some locale facets. 7436ac495dSmrg For more details see <a class="xref" href="using_dual_abi.html" title="Dual ABI">Dual ABI</a>. 7536ac495dSmrg </p></dd><dt><span class="term"><code class="code">_GLIBCXX_CONCEPT_CHECKS</code></span></dt><dd><p> 7636ac495dSmrg Undefined by default. Configurable via 7736ac495dSmrg <code class="code">--enable-concept-checks</code>. When defined, performs 7836ac495dSmrg compile-time checking on certain template instantiations to 7936ac495dSmrg detect violations of the requirements of the standard. This 8036ac495dSmrg macro has no effect for freestanding implementations. 8136ac495dSmrg This is described in more detail in 8236ac495dSmrg <a class="link" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks">Compile Time Checks</a>. 8336ac495dSmrg </p></dd><dt><span class="term"><code class="code">_GLIBCXX_ASSERTIONS</code></span></dt><dd><p> 8436ac495dSmrg Undefined by default. When defined, enables extra error checking in 8536ac495dSmrg the form of precondition assertions, such as bounds checking in 8636ac495dSmrg strings and null pointer checks when dereferencing smart pointers. 8736ac495dSmrg </p></dd><dt><span class="term"><code class="code">_GLIBCXX_DEBUG</code></span></dt><dd><p> 8836ac495dSmrg Undefined by default. When defined, compiles user code using 8936ac495dSmrg the <a class="link" href="debug_mode.html" title="Chapter 17. Debug Mode">debug mode</a>. 9036ac495dSmrg When defined, <code class="code">_GLIBCXX_ASSERTIONS</code> is defined 9136ac495dSmrg automatically, so all the assertions enabled by that macro are also 9236ac495dSmrg enabled in debug mode. 9336ac495dSmrg </p></dd><dt><span class="term"><code class="code">_GLIBCXX_DEBUG_PEDANTIC</code></span></dt><dd><p> 9436ac495dSmrg Undefined by default. When defined while compiling with 9536ac495dSmrg the <a class="link" href="debug_mode.html" title="Chapter 17. Debug Mode">debug mode</a>, makes 9636ac495dSmrg the debug mode extremely picky by making the use of libstdc++ 9736ac495dSmrg extensions and libstdc++-specific behavior into errors. 9836ac495dSmrg </p></dd><dt><span class="term"><code class="code">_GLIBCXX_PARALLEL</code></span></dt><dd><p>Undefined by default. When defined, compiles user code 9936ac495dSmrg using the <a class="link" href="parallel_mode.html" title="Chapter 18. Parallel Mode">parallel 10036ac495dSmrg mode</a>. 10136ac495dSmrg </p></dd><dt><span class="term"><code class="code">_GLIBCXX_PARALLEL_ASSERTIONS</code></span></dt><dd><p>Undefined by default, but when any parallel mode header is included 10236ac495dSmrg this macro will be defined to a non-zero value if 10336ac495dSmrg <code class="code">_GLIBCXX_ASSERTIONS</code> has a non-zero value, otherwise to zero. 10436ac495dSmrg When defined to a non-zero value, it enables extra error checking and 10536ac495dSmrg assertions in the parallel mode. 10636ac495dSmrg </p></dd><dt><span class="term"><code class="code">__STDCPP_WANT_MATH_SPEC_FUNCS__</code></span></dt><dd><p>Undefined by default. When defined to a non-zero integer constant, 10736ac495dSmrg enables support for ISO/IEC 29124 Special Math Functions. 108a2dc1f3fSmrg </p></dd><dt><span class="term"><code class="code">_GLIBCXX_SANITIZE_VECTOR</code></span></dt><dd><p> 109a2dc1f3fSmrg Undefined by default. When defined, <code class="classname">std::vector</code> 110a2dc1f3fSmrg operations will be annotated so that AddressSanitizer can detect 111a2dc1f3fSmrg invalid accesses to the unused capacity of a 112a2dc1f3fSmrg <code class="classname">std::vector</code>. These annotations are only 113a2dc1f3fSmrg enabled for 114a2dc1f3fSmrg <code class="classname">std::vector<T, std::allocator<T>></code> 115a2dc1f3fSmrg and only when <code class="classname">std::allocator</code> is derived from 116*c0a68be4Smrg <a class="link" href="memory.html#allocator.ext" title="Extension Allocators"><code class="classname">new_allocator</code> 117a2dc1f3fSmrg or <code class="classname">malloc_allocator</code></a>. The annotations 118a2dc1f3fSmrg must be present on all vector operations or none, so this macro must 119a2dc1f3fSmrg be defined to the same value for all translation units that create, 120a2dc1f3fSmrg destroy or modify vectors. 12136ac495dSmrg </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="using_headers.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="using.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="using_dual_abi.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Headers </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Dual ABI</td></tr></table></div></body></html>