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

4.5 KiB

[cstring.syn]

27 Strings library [strings]

27.5 Null-terminated sequence utilities [c.strings]

27.5.1 Header synopsis [cstring.syn]

🔗

#define STDC_VERSION_STRING_H 202311Lnamespace std {using size_t = see [support.types.layout]; // freestandingvoid* memcpy(void* s1, const void* s2, size_t n); // freestandingvoid* memccpy(void* s1, const void* s2, int c, size_t n); // freestandingvoid* memmove(void* s1, const void* s2, size_t n); // freestandingchar* strcpy(char* s1, const char* s2); // freestandingchar* strncpy(char* s1, const char* s2, size_t n); // freestandingchar* strdup(const char* s); char* strndup(const char* s, size_t size); char* strcat(char* s1, const char* s2); // freestandingchar* strncat(char* s1, const char* s2, size_t n); // freestandingint memcmp(const void* s1, const void* s2, size_t n); // freestandingint strcmp(const char* s1, const char* s2); // freestandingint strcoll(const char* s1, const char* s2); int strncmp(const char* s1, const char* s2, size_t n); // freestanding size_t strxfrm(char* s1, const char* s2, size_t n); const void* memchr(const void* s, int c, size_t n); // freestanding; see [library.c]void* memchr(void* s, int c, size_t n); // freestanding; see [library.c]const char* strchr(const char* s, int c); // freestanding; see [library.c]char* strchr(char* s, int c); // freestanding; see [library.c] size_t strcspn(const char* s1, const char* s2); // freestandingconst char* strpbrk(const char* s1, const char* s2); // freestanding; see [library.c]char* strpbrk(char* s1, const char* s2); // freestanding; see [library.c]const char* strrchr(const char* s, int c); // freestanding; see [library.c]char* strrchr(char* s, int c); // freestanding; see [library.c] size_t strspn(const char* s1, const char* s2); // freestandingconst char* strstr(const char* s1, const char* s2); // freestanding; see [library.c]char* strstr(char* s1, const char* s2); // freestanding; see [library.c]char* strtok(char* s1, const char* s2); void* memset(void* s, int c, size_t n); // freestandingvoid* memset_explicit(void* s, int c, size_t n); // freestandingchar* strerror(int errnum); size_t strlen(const char* s); // freestanding}#define NULL see [support.types.nullptr] // freestanding

1

#

The contents and meaning of the header are the same as the C standard library header <string.h>.

2

#

The functions strerror and strtok are not required toavoid data races.

3

#

The functions memcpy and memmove are signal-safe.

Each of these functions implicitly creates objects ([intro.object]) in the destination region of storage immediately prior to copying the sequence of characters to the destination.

Each of these functions returns a pointer to a suitable created object, if any, otherwise the value of the first parameter.

4

#

[Note 1:

The functionsstrchr, strpbrk, strrchr, strstr, and memchr, have different signatures in this document, but they have the same behavior as in the C standard library.

— end note]

See also: ISO/IEC 9899:2024, 7.26