Annex C (informative) Compatibility [diff]

C.7 C standard library [diff.library]

C.7.1 General [diff.library.general]

Subclause [diff.library] summarizes the explicit changes in headers, definitions, declarations, or behavior between the C standard library in the C standard and the parts of the C++ standard library that were included from the C standard library.

C.7.2 Modifications to headers [diff.mods.to.headers]

For compatibility with the C standard library, the C++ standard library provides the C headers enumerated in [support.c.headers].
There are no C++ headers for the C standard library's headers <stdnoreturn.h> and <threads.h>, nor are these headers from the C standard library headers themselves part of C++.
The C headers <complex.h> and <tgmath.h> do not contain any of the content from the C standard library and instead merely include other headers from the C++ standard library.

C.7.3 Modifications to definitions [diff.mods.to.definitions]

C.7.3.1 Types char16_­t and char32_­t [diff.char16]

The types char16_­t and char32_­t are distinct types rather than typedefs to existing integral types.
The tokens char16_­t and char32_­t are keywords in C++ ([lex.key]).
They do not appear as macro or type names defined in <cuchar>.

C.7.3.2 Type wchar_­t [diff.wchar.t]

The type wchar_­t is a distinct type rather than a typedef to an existing integral type.
The token wchar_­t is a keyword in C++ ([lex.key]).
It does not appear as a macro or type name defined in any of <cstddef>, <cstdlib>, or <cwchar>.

C.7.3.3 Header <assert.h> [diff.header.assert.h]

The token static_­assert is a keyword in C++.
It does not appear as a macro name defined in <cassert>.

C.7.3.4 Header <iso646.h> [diff.header.iso646.h]

The tokens and, and_­eq, bitand, bitor, compl, not, not_­eq, or, or_­eq, xor, and xor_­eq are keywords in C++ ([lex.key]), and are not introduced as macros by <iso646.h>.

C.7.3.5 Header <stdalign.h> [diff.header.stdalign.h]

The token alignas is a keyword in C++ ([lex.key]), and is not introduced as a macro by <stdalign.h>.

C.7.3.6 Header <stdbool.h> [diff.header.stdbool.h]

The tokens bool, true, and false are keywords in C++ ([lex.key]), and are not introduced as macros by <stdbool.h>.

C.7.3.7 Macro NULL [diff.null]

The macro NULL, defined in any of <clocale>, <cstddef>, <cstdio>, <cstdlib>, <cstring>, <ctime>, or <cwchar>, is an implementation-defined null pointer constant in C++ ([support.types]).

C.7.4 Modifications to declarations [diff.mods.to.declarations]

Header <cstring>: The following functions have different declarations:
Subclause [cstring.syn] describes the changes.
Header <cwchar>: The following functions have different declarations:
Subclause [cwchar.syn] describes the changes.
Header <cstddef> declares the names nullptr_­t, byte, and to_­integer, and the operators and operator templates in ([support.types.byteops]), in addition to the names declared in <stddef.h> in the C standard library.

C.7.5 Modifications to behavior [diff.mods.to.behavior]

C.7.5.1 General [diff.mods.to.behavior.general]

Header <cstdlib>: The following functions have different behavior:
Subclause [support.start.term] describes the changes.
Header <csetjmp>: The following functions have different behavior:
Subclause [csetjmp.syn] describes the changes.

C.7.5.2 Macro offsetof(type, member-designator) [diff.offsetof]

The macro offsetof, defined in <cstddef>, accepts a restricted set of type arguments in C++.
Subclause [support.types.layout] describes the change.

C.7.5.3 Memory allocation functions [diff.malloc]

The functions aligned_­alloc, calloc, malloc, and realloc are restricted in C++.
Subclause [c.malloc] describes the changes.