Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
C++ Standard Library
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===C standard library=== {{Main article|C standard library}} Each header from the C Standard Library is included in the C++ Standard Library under a different name, generated by removing the '{{mono|.h}}' file extension, and adding a '{{mono|c}}' at the start; for example, '<code>time.h</code>' becomes '<code>ctime</code>'. The only difference between these headers and the traditional C Standard Library headers is that where possible the functions should be placed into the <code>std::</code> namespace. In ISO C, functions in the standard library are allowed to be implemented by [[C preprocessor|macros]], which is not allowed by ISO C++. Usage of the C headers with the '{{mono|.h}}' file extension is legal in C++ and used for compatibility. {| class="wikitable" ! Name !! Description |- | {{code|<cassert>}} || Related to <code>[[assert.h|<assert.h>]]</code>. Declares the [[assertion (computing)|assert]] macro, used to assist with detecting logical errors and other types of bugs while [[debugging]] a program. |- | style="background:#F99" | {{code|<ccomplex>}} | style="background:#F99" | Related to <code>[[complex.h|<complex.h>]]</code>. Defines a [[C mathematical functions#complex.h|set of functions]] for manipulating [[complex number]]s. Deprecated in [[C++17]], removed in [[C++20]]. |- | {{code|<cctype>}} || Related to <code>[[ctype.h|<ctype.h>]]</code>. Defines [[C character classification|set of functions]] used to classify characters by their types or to convert between upper and lower case in a way that is independent of the used [[character set]] (typically [[ASCII]] or one of its extensions, although implementations utilizing [[EBCDIC]] are also known). |- | {{code|<cerrno>}} || Related to <code>[[errno.h|<errno.h>]]</code>. For testing error codes reported by library functions. |- | {{code|<cfenv>}} || Related to <code>[[errno.h|<errno.h>]]</code>. Defines a [[C mathematical functions#fenv.h|set of functions]] for controlling [[floating-point]] environment. |- | {{code|<cfloat>}} || Related to <code>[[float.h|<float.h>]]</code>. Defines [[C data types#float.h|macro constants]] specifying the implementation-specific properties of the [[floating-point]] library. |- | {{code|<cinttypes>}} || Related to <code>[[inttypes.h|<inttypes.h>]]</code>. Defines [[C data types#inttypes.h|exact-width integer types]]. |- | style="background:#F99" | {{code|<ciso646>}} | style="background:#F99" | Related to <code>[[iso646.h|<iso646.h>]]</code>. Defines [[C alternative tokens|several macros]] that implement alternative ways to express several standard tokens. For programming in [[ISO 646]] variant character sets. Removed in [[C++20]]. |- | {{code|<climits>}} || Related to <code>[[limits.h|<limits.h>]]</code>. Defines [[C data types#limits.h|macro constants]] specifying the implementation-specific properties of the integer types. |- | {{code|<clocale>}} || Related to <code><locale.h></code>. Defines [[C localization functions|localization functions]]. |- | {{code|<cmath>}} || Related to <code>[[math.h|<math.h>]]</code>. Defines [[C mathematical functions|common mathematical functions]]. Extends <code><math.h></code>, containing special mathematical functions such as [[Bessel function]]s and the [[Riemann zeta function]]. |- | {{code|<csetjmp>}} || Related to <code>[[setjmp.h|<setjmp.h>]]</code>. Declares the macros <code>setjmp</code> and <code>longjmp</code>, which are used for non-local exits. |- | {{code|<csignal>}} || Related to <code>[[signal.h|<signal.h>]]</code>. Defines [[C signal handling|signal-handling functions]]. |- | style="background:#F99" | {{code|<cstdalign>}} | style="background:#F99" | Related to <code><stdalign.h></code>. For querying and specifying the [[Data structure alignment|alignment]] of objects. Deprecated in [[C++17]], removed in [[C++20]]. |- | {{code|<cstdarg>}} || Related to <code>[[stdarg.h|<stdarg.h>]]</code>. For [[Linearizability|atomic operations]] on data shared between threads. |- | style="background:#F99" | {{code|<cstdbool>}} | style="background:#F99" | Related to <code>[[stdbool.h|<stdbool.h>]]</code>. Defines [[C data types#stdbool.h|a Boolean data type]]. Deprecated in [[C++17]], removed in [[C++20]]. |- | {{code|<cstddef>}} || Related to <code>[[stddef.h|<stddef.h>]]</code>. Defines [[C data types#stddef.h|several useful types and macros]]. |- | {{code|<cstdint>}} || Related to <code>[[stdint.h|<stdint.h>]]</code>. Defines [[C data types#stdint.h|exact-width integer types]]. |- | {{code|<cstdio>}} || Related to <code>[[stdio.h|<stdio.h>]]</code>. Defines [[C file input/output|core input and output functions]]. |- | {{code|<cstring>}} || Related to <code>[[string.h|<string.h>]]</code>. Defines [[C string handling|string-handling functions]]. |- | style="background:#F99" | {{code|<ctgmath>}} | style="background:#F99" | Related to <code>[[tgmath.h|<tgmath.h>]]</code>. Defines [[C mathematical functions#tgmath.h|type-generic mathematical functions]]. Deprecated in [[C++17]], removed in [[C++20]]. |- | {{code|<ctime>}} || Related to <code>[[time.h|<time.h>]]</code>. Defines [[C date and time functions|date- and time-handling functions]]. |- | {{code|<cuchar>}} || Related to <code><uchar.h></code>. Types and functions for manipulating [[Unicode]] characters. |- | {{code|<cwchar>}} || Related to <code>[[wchar.h|<wchar.h>]]</code>. Defines [[C string handling|wide-string-handling functions]]. |- | {{code|<cwctype>}} || Related to <code>[[wctype.h|<wctype.h>]]</code>. Defines [[C character classification|set of functions]] used to classify wide characters by their types or to convert between upper and lower case. |} The following headers are special C compatibility headers which do not have a corresponding C++ naming convention, meaning that the C headers ''must'' be used if the header is necessary. {| class="wikitable" ! Name !! Description |- | {{code|<stdatomic.h>}} || Added in [[C++23]]. Related to <code><stdatomic.h></code>. For [[Linearizability|atomic operations]] on data shared between threads. |} The C headers <code><stdnoreturn.h></code> and <code><threads.h></code> do not have C++ equivalents and their C headers are not supported in C++. C++ does not provide the [[C POSIX library]] as part of any standard, however it is legal to use in a C++ program. If used in C++, the POSIX headers are not prepended with a "{{mono|c}}" at the beginning of the name, and all contain the {{mono|.h}} suffix in the header name. Most headers in the POSIX library typically have a C++ equivalent implementation, such as <code><regex></code> rather than <code><regex.h></code>.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)