For compatibility with the
C standard library, the C++ standard library provides
the C headers shown in Table 39.
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 ISO C.
Source files that are not intended to also be valid ISO C
should not use any of the C headers.
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.
The following source file is both valid C++ and valid ISO 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<stdbool.h>// for bool in C, no effect in C++#include<stddef.h>// for size_t#ifdef __cplusplus // see [cpp.predefined]extern"C"// see [dcl.link]#endifvoid f(bool b[], size_t n);
β end example]
The contents of the C++ header <stdalign.h> are the same as the C
standard library header <stdalign.h>, with the following changes:
The header <stdalign.h> does not
define a macro named alignas.
The contents of the C++ header <stdbool.h> are the same as the C
standard library header <stdbool.h>, with the following changes:
The header <stdbool.h> does not
define macros named bool, true, or false.
Every C header
other than
<complex.h>,
<iso646.h>,
<stdalign.h>, <stdatomic.h>,
<stdbool.h>, and
<tgmath.h>,
each of
which has a name of the form
<name.h>,
behaves as if each name placed in the standard library namespace by
the corresponding
<cname>
header is placed within
the global namespace scope,
except for the functions described in [sf.cmath],
the declaration of std::byte ([cstddef.syn]), and
the functions and function templates described in [support.types.byteops].
It is unspecified whether these names are first declared or defined within
namespace scope ([basic.scope.namespace]) of the namespace
std and are then injected into the global namespace scope by
explicit using-declarations ([namespace.udecl]).