Files
cppdraft_translate/cppdraft/support/c/headers/general.md
2025-10-25 03:02:53 +03:00

3.3 KiB

[support.c.headers.general]

17 Language support library [support]

17.15 C headers [support.c.headers]

17.15.1 General [support.c.headers.general]

1

#

For compatibility with theC standard library, the C++ standard library provides the C headers shown in Table 47.

The intended use of these headers is for interoperability only.

It is possible that C++ source files need to include one of these headers in order to be valid C. Source files that are not intended to also be valid C should not use any of the C headers.

[Note 1:

The C headers either have no effect, such as <stdbool.h> and <stdalign.h>, or otherwise the corresponding header of the form <cname> provides the same facilities and assuredly defines them in namespace std.

— end note]

[Example 1:

The following source file is both valid C++ and valid C. Viewed as C++, it declares a function with C language linkage; viewed as C it simply declares a function (and provides a prototype).

#include <uchar.h> // for char8_t in C, not necessary in C++#include <stddef.h> // for size_t#ifdef __cplusplus // see [cpp.predefined]extern "C" // see [dcl.link]#endifvoid f(char8_t s[], size_t n); — end example]

Table 47 — C headers [tab:c.headers]

🔗
<assert.h>
<inttypes.h> <signal.h> <stdckdint.h> <tgmath.h>
🔗
<complex.h>
<iso646.h> <stdalign.h> <stddef.h> <time.h>
🔗
<ctype.h>
<limits.h> <stdarg.h> <stdint.h> <uchar.h>
🔗
<errno.h>
<locale.h> <stdatomic.h> <stdio.h> <wchar.h>
🔗
<fenv.h>
<math.h> <stdbit.h> <stdlib.h> <wctype.h>
🔗
<float.h>
<setjmp.h> <stdbool.h> <string.h>