All library macros begin with _GLIBCXX_
.
Furthermore, all pre-processor macros, switches, and
configuration options are gathered in the
file c++config.h
, which
is generated during the libstdc++ configuration and build
process. This file is then included when needed by files part of
the public libstdc++ API, like
<ios>
. Most of these
macros should not be used by consumers of libstdc++, and are reserved
for internal implementation use. These macros cannot
be redefined.
A select handful of macros control libstdc++ extensions and extra features, or provide versioning information for the API. Only those macros listed below are offered for consideration by the general public.
Below is the macro which users may check for library version information.
__GLIBCXX__
The current version of libstdc++ in compressed ISO date format, as an unsigned long. For details on the value of this particular macro for a particular release, please consult the ABI Policy and Guidelines appendix.
Below are the macros which users may change with #define/#undef or with -D/-U compiler flags. The default state of the symbol is listed.
“Configurable” (or “Not configurable”) means that the symbol is initially chosen (or not) based on --enable/--disable options at library build and configure time (documented in Configure), with the various --enable/--disable choices being translated to #define/#undef).
ABI means that changing from the default value may mean changing the ABI of compiled code. In other words, these choices control code which has already been compiled (i.e., in a binary such as libstdc++.a/.so). If you explicitly #define or #undef these macros, the headers may see different code paths, but the libraries which you link against will not. Experimenting with different values with the expectation of consistent linkage requires changing the config headers before building/installing the library.
_GLIBCXX_USE_DEPRECATED
Defined by default. Not configurable. ABI-changing. Turning this off
removes older ARM-style iostreams code, and other anachronisms
from the API. This macro is dependent on the version of the
standard being tracked, and as a result may give different results for
-std=c++98
and -std=c++11
. This may
be useful in updating old C++ code which no longer meet the
requirements of the language, or for checking current code
against new language standards.
_GLIBCXX_USE_CXX11_ABI
Defined to the value 1
by default.
Configurable via --disable-libstdcxx-dual-abi
and/or --with-default-libstdcxx-abi
.
ABI-changing.
When defined to a non-zero value the library headers will use the
new C++11-conforming ABI introduced in GCC 5, rather than the older
ABI introduced in GCC 3.4. This changes the definition of several
class templates, including std:string
,
std::list
and some locale facets.
For more details see Dual ABI.
_GLIBCXX_CONCEPT_CHECKS
Undefined by default. Configurable via
--enable-concept-checks
. When defined, performs
compile-time checking on certain template instantiations to
detect violations of the requirements of the standard. This
macro has no effect for freestanding implementations.
This is described in more detail in
Compile Time Checks.
_GLIBCXX_ASSERTIONS
Undefined by default. When defined, enables extra error checking in the form of precondition assertions, such as bounds checking in strings and null pointer checks when dereferencing smart pointers.
_GLIBCXX_DEBUG
Undefined by default. When defined, compiles user code using
the debug mode.
When defined, _GLIBCXX_ASSERTIONS
is defined
automatically, so all the assertions enabled by that macro are also
enabled in debug mode.
_GLIBCXX_DEBUG_PEDANTIC
Undefined by default. When defined while compiling with the debug mode, makes the debug mode extremely picky by making the use of libstdc++ extensions and libstdc++-specific behavior into errors.
_GLIBCXX_PARALLEL
Undefined by default. When defined, compiles user code using the parallel mode.
_GLIBCXX_PROFILE
Undefined by default. When defined, compiles user code using the profile mode.
__STDCPP_WANT_MATH_SPEC_FUNCS__
Undefined by default. When defined to a non-zero integer constant, enables support for ISO/IEC 29124 Special Math Functions.