[support.c.headers] (original) (raw)

17 Language support library [support]

17.14.1 General [support.c.headers.general]

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

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 and , or otherwise the corresponding header of the form <c_name_>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 <stdbool.h> #include <stddef.h> #ifdef __cplusplus extern "C" #endif void f(bool b[], size_t n); — _end example_]

17.14.2 Header <complex.h> synopsis [complex.h.syn]

The header behaves as if it simply includes the header.

[Note 1:

Names introduced by in namespace stdare not placed into the global namespace scope by .

— _end note_]

17.14.3 Header <iso646.h> synopsis [iso646.h.syn]

The C++ header is empty.

[Note 1:

and,and_eq,bitand,bitor,compl,not_eq,not,or,or_eq,xor, andxor_eqare keywords in C++ ([lex.key]).

— _end note_]

17.14.4 Header <stdalign.h> synopsis [stdalign.h.syn]

The contents of the C++ header are the same as the C standard library header , with the following changes: The header does not define a macro named alignas.

See also: ISO/IEC 9899:2018, 7.15

17.14.5 Header <stdbool.h> synopsis [stdbool.h.syn]

The contents of the C++ header are the same as the C standard library header , with the following changes: The header does not define macros named bool, true, or false.

See also: ISO/IEC 9899:2018, 7.18

17.14.6 Header <tgmath.h> synopsis [tgmath.h.syn]

The header behaves as if it simply includes the headers and.

[Note 1:

The overloads provided in C by type-generic macros are already provided in and by “sufficient” additional overloads.

— _end note_]

[Note 2:

Names introduced by or in namespace stdare not placed into the global namespace scope by .

— _end note_]

17.14.7 Other C headers [support.c.headers.other]

Every C header other than,,,
,, and, 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<c_name_>header is placed within the global namespace scope, except for the functions described in [sf.cmath], the std​::​lerp function overloads ([c.math.lerp]), 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 namespacestd and are then injected into the global namespace scope by explicit using-declarations ([namespace.udecl]).

[Example 1:

The header assuredly provides its declarations and definitions within the namespacestd.

It may also provide these names within the global namespace.

The header assuredly provides the same declarations and definitions within the global namespace, much as in ISO/IEC 9899.

It may also provide these names within the namespace std.

— _end example_]