C++ Standard Library headers - cppreference.com (original) (raw)
The interface of C++ standard library is defined by the following collection of headers.
[edit]
For some of the C standard library headers of the form _xxx_.h
, the C++ standard library both includes an identically-named header and another header of the form c_xxx_
(all meaningful c_xxx_
headers are listed above). The intended use of headers of form _xxx_.h
is for interoperability only. It is possible that C++ source files need to include one of these headers in order to be valid ISO C. Source files that are not intended to also be valid ISO C should not use any of the C headers.
With the exception of complex.h, each _xxx_.h
header included in the C++ standard library places in the global namespace each name that the corresponding c_xxx_
header would have placed in the std namespace.
These headers are allowed to also declare the same names in the std namespace, and the corresponding c_xxx_
headers are allowed to also declare the same names in the global namespace: including definitely provides std::malloc and may also provide ::malloc. Including <stdlib.h> definitely provides ::malloc and may also provide std::malloc. This applies even to functions and function overloads that are not part of C standard library.
Notes: _xxx_.h
headers are deprecated in C++98 and undeprecated in C++23. These headers are discouraged for pure C++ code, but not subject to future removal.
<assert.h> | Behaves same as [edit] |
---|---|
<ctype.h> | Behaves as if each name from is placed in global namespace[edit] |
<errno.h> | Behaves same as [edit] |
<fenv.h>(C++11) | Behaves as if each name from is placed in global namespace[edit] |
<float.h> | Behaves same as [edit] |
<inttypes.h>(C++11) | Behaves as if each name from is placed in global namespace[edit] |
<limits.h> | Behaves same as [edit] |
<locale.h> | Behaves as if each name from is placed in global namespace[edit] |
<math.h> | Behaves as if each name from is placed in global namespace,except for names of mathematical special functions[edit] |
<setjmp.h> | Behaves as if each name from is placed in global namespace[edit] |
<signal.h> | Behaves as if each name from is placed in global namespace[edit] |
<stdarg.h> | Behaves as if each name from is placed in global namespace[edit] |
<stddef.h> | Behaves as if each name from is placed in global namespace,except for names of std::byte and related functions[edit] |
<stdint.h>(C++11) | Behaves as if each name from is placed in global namespace[edit] |
<stdio.h> | Behaves as if each name from is placed in global namespace[edit] |
<stdlib.h> | Behaves as if each name from is placed in global namespace[edit] |
<string.h> | Behaves as if each name from is placed in global namespace[edit] |
<time.h> | Behaves as if each name from is placed in global namespace[edit] |
<uchar.h>(C++11) | Behaves as if each name from is placed in global namespace[edit] |
<wchar.h> | Behaves as if each name from is placed in global namespace[edit] |
<wctype.h> | Behaves as if each name from is placed in global namespace[edit] |
[edit]
The headers <stdatomic.h>, <stdbit.h>, and <stdckdint.h> declare names which are also provided in the C standard library. The header <stdatomic.h> also defines the _Atomic macro which is a keyword in C. Unlike other <_xxx_.h>
headers, corresponding <cstdatomic>
, <cstdbit>
, and <cstdckdint>
are not provided.
| | Defines _Atomic and provides corresponding components in the C standard library[edit] | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | Provides corresponding components in the C standard library[edit] | | | Provides corresponding components in the C standard library[edit] |
[edit]
The headers <complex.h>, , <tgmath.h>, and do not contain any content from the C standard library and instead merely include other headers from the C++ standard library.
[edit]
The headers , , and are meaningless in C++ because the macros they provide in C are language keywords in C++.
(removed in C++20) | Empty header. The macros that appear in iso646.h in C are keywords in C++[edit] |
---|---|
(C++11)(deprecated in C++17)(removed in C++20) | Defines compatibility macro constants __alignas_is_defined and __alignof_is_defined[edit] |
(C++11)(deprecated in C++17)(removed in C++20) | Defines a compatibility macro constant __bool_true_false_are_defined[edit] |
<iso646.h> | Has no effect[edit] |
<stdalign.h>(C++11) | Defines compatibility macro constants __alignas_is_defined and __alignof_is_defined[edit] |
<stdbool.h>(C++11) | Defines a compatibility macro constant __bool_true_false_are_defined[edit] |
[edit]
The C headers <stdatomic.h>,(until C++23) <stdnoreturn.h>, and <threads.h> are not included in C++ and have no c_xxx_
equivalents.
[edit] Experimental libraries
C++ TR's/TS's also define several collections of headers.