Files
cppdraft_translate/cppdraft/diff/library.md
2025-10-25 03:02:53 +03:00

9.6 KiB

[diff.library]

Annex C (informative) Compatibility [diff]

C.8 C standard library [diff.library]

C.8.1 General [diff.library.general]

1

#

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.8.2 Modifications to headers [diff.mods.to.headers]

1

#

For compatibility with the C standard library, the C++ standard library provides the C headers enumerated in [support.c.headers].

2

#

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++.

3

#

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.8.3 Modifications to definitions [diff.mods.to.definitions]

C.8.3.1 Types char8_t, char16_t, and char32_t [diff.char16]

1

#

The types char8_t, char16_t, and char32_t are distinct types rather than typedefs to existing integral types.

The tokens char8_t, char16_t, and char32_t are keywords in C++ ([lex.key]).

They do not appear as macro or type names defined in.

C.8.3.2 Type wchar_t [diff.wchar.t]

1

#

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,, or .

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

1

#

The tokensand,and_eq,bitand,bitor,compl,not,not_eq,or,or_eq,xor, andxor_eq are keywords in C++ ([lex.key]), and are not introduced as macros by <iso646.h>.

C.8.3.4 Macro NULL [diff.null]

1

#

The macroNULL, defined in any of,,,,,, or , is an implementation-defined null pointer constant in C++ ([support.types]).

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

1

#

Header : The following functions have different declarations:

strchr

strpbrk

strrchr

strstr

memchr

Subclause [cstring.syn] describes the changes.

2

#

Header : The following functions have different declarations:

wcschr

wcspbrk

wcsrchr

wcsstr

wmemchr

Subclause [cwchar.syn] describes the changes.

3

#

Header 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.8.5 Modifications to behavior [diff.mods.to.behavior]

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

1

#

Header : The following functions have different behavior:

atexit

exit

abort

Subclause [support.start.term] describes the changes.

2

#

Header : The following functions have different behavior:

longjmp

Subclause [csetjmp.syn] describes the changes.

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

1

#

The macro offsetof, defined in, accepts a restricted set of type arguments in C++.

Subclause [support.types.layout] describes the change.

C.8.5.3 Memory allocation functions [diff.malloc]

1

#

The functionsaligned_alloc,calloc,malloc, andrealloc are restricted in C++.

Subclause [c.malloc] describes the changes.