21 Strings library [strings]

21.7 Null-terminated sequence utilities [c.strings]

Tables [tab:strings.hdr.cctype], [tab:strings.hdr.cwctype], [tab:strings.hdr.cstring], [tab:strings.hdr.cwchar], [tab:strings.hdr.cstdlib], and [tab:strings.hdr.cuchar] describe headers <cctype>, <cwctype>, <cstring>, <cwchar>, <cstdlib> (character conversions), and <cuchar>, respectively.

The contents of these headers shall be the same as the Standard C Library headers <ctype.h>, <wctype.h>, <string.h>, <wchar.h>, and <stdlib.h> and the C Unicode TR header <uchar.h>, respectively, with the following modifications:

The headers shall not define the types char16_t, char32_t, and wchar_t ([lex.key]).

The function signature strchr(const char*, int) shall be replaced by the two declarations:

const char* strchr(const char* s, int c);
      char* strchr(      char* s, int c);

both of which shall have the same behavior as the original declaration.

The function signature strpbrk(const char*, const char*) shall be replaced by the two declarations:

const char* strpbrk(const char* s1, const char* s2);
      char* strpbrk(      char* s1, const char* s2);

both of which shall have the same behavior as the original declaration.

The function signature strrchr(const char*, int) shall be replaced by the two declarations:

const char* strrchr(const char* s, int c);
      char* strrchr(      char* s, int c);

both of which shall have the same behavior as the original declaration.

The function signature strstr(const char*, const char*) shall be replaced by the two declarations:

const char* strstr(const char* s1, const char* s2);
      char* strstr(      char* s1, const char* s2);

both of which shall have the same behavior as the original declaration.

The function signature memchr(const void*, int, size_t) shall be replaced by the two declarations:

const void* memchr(const void* s, int c, size_t n);
      void* memchr(      void* s, int c, size_t n);

both of which shall have the same behavior as the original declaration.

The function signature wcschr(const wchar_t*, wchar_t) shall be replaced by the two declarations:

const wchar_t* wcschr(const wchar_t* s, wchar_t c);
      wchar_t* wcschr(      wchar_t* s, wchar_t c);

both of which shall have the same behavior as the original declaration.

The function signature wcspbrk(const wchar_t*, const wchar_t*) shall be replaced by the two declarations:

const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
      wchar_t* wcspbrk(      wchar_t* s1, const wchar_t* s2);

both of which shall have the same behavior as the original declaration.

The function signature wcsrchr(const wchar_t*, wchar_t) shall be replaced by the two declarations:

const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
      wchar_t* wcsrchr(      wchar_t* s, wchar_t c);

both of which shall have the same behavior as the original declaration.

The function signature wcsstr(const wchar_t*, const wchar_t*) shall be replaced by the two declarations:

const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
      wchar_t* wcsstr(      wchar_t* s1, const wchar_t* s2);

both of which shall have the same behavior as the original declaration.

The function signature wmemchr(const wwchar_t*, int, size_t) shall be replaced by the two declarations:

const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
      wchar_t* wmemchr(      wchar_t* s, wchar_t c, size_t n);

both of which shall have the same behavior as the original declaration.

The functions strerror and strtok are not required to avoid data races ([res.on.data.races]).

Calling the functions listed in Table [tab:mbstate.data.races] with an mbstate_t* argument of NULL may introduce a data race ([res.on.data.races]) with other calls to these functions with an mbstate_t* argument of NULL.

Table 73 — Potential mbstate_t data races
mbrlen mbrtowc mbsrtowc mbtowc wcrtomb
wcsrtomb wctomb

See also: ISO C 7.3, 7.10.7, 7.10.8, and 7.11. Amendment 1 4.4, 4.5, and 4.6.

Table 74 — Header <cctype> synopsis
TypeName(s)
Functions:
isalnum isblank isdigit isprint isupper
tolower isalpha isgraph ispunct isxdigit
toupper iscntrl islower isspace
Table 75 — Header <cwctype> synopsis
TypeName(s)
Macro: WEOF
Types: wctrans_t wctype_t wint_t
Functions:
iswalnum iswctype iswprint iswxdigit wctrans
iswalpha iswdigit iswpunct towctrans wctype
iswblank iswgraph iswspace towlower
iswcntrl iswlower iswupper towupper
Table 76 — Header <cstring> synopsis
TypeName(s)
Macro: NULL <cstring>
Type: size_t <cstring>
Functions:
memchr strcat strcspn strncpy strtok
memcmp strchr strerror strpbrk strxfrm
memcpy strcmp strlen strrchr
memmove strcoll strncat strspn
memset strcpy strncmp strstr
Table 77 — Header <cwchar> synopsis
TypeName(s)
Macros: NULL WCHAR_MAX WCHAR_MIN WEOF
Types: mbstate_t wint_t size_t tm
Functions:
btowc mbsinit vwscanf wcsncpy wcstoull
fgetwc mbsrtowcs wcrtomb wcspbrk wcstoul
fgetws putwchar wcscat wcsrchr wcsxfrm
fputwc putwc wcschr wcsrtombs wctob
fputws swprintf wcscmp wcsspn wmemchr
fwide swscanf wcscoll wcsstr wmemcmp
fwprintf ungetwc wcscpy wcstod wmemcpy
fwscanf vfwprintf wcscspn wcstof wmemmove
getwchar vfwscanf wcsftime wcstok wmemset
getwc vswprintf wcslen wcstold wprintf
mbrlen vswscanf wcsncat wcstoll wscanf
mbrtowc vwprintf wcsncmp wcstol
Table 78 — Header <cstdlib> synopsis
TypeName(s)
Macros: MB_CUR_MAX
Functions:
atof mblen strtof strtoul
atoi mbtowc strtol strtoull
atol mbstowcs strtold wctomb
atoll strtod strtoll wcstombs
Table 79 — Header <cuchar> synopsis
TypeName(s)
Macros: __STDC_UTF_16__
__STDC_UTF_32__
Functions: mbrtoc16 c16rtomb
mbrtoc32 c32rtomb