Terminology In historical documentation the term "character" was often used instead of "byte" for C strings, which leads many to believe that these functions somehow do not work for
UTF-8. In fact all lengths are defined as being in bytes and this is true in all implementations, and these functions work as well with UTF-8 as with single-byte encodings. The BSD documentation has been fixed to make this clear, but POSIX, Linux, and Windows documentation still uses "character" in many places where "byte" or "wchar_t" is the correct term. Functions for handling memory buffers can process sequences of bytes that include null-byte as part of the data. Names of these functions typically start with mem, as opposite to the str prefix.
Headers Most of the functions that operate on C strings are declared in the string.h header (cstring in C++), while functions that operate on C wide strings are declared in the wchar.h header (cwchar in C++). These headers also contain declarations of functions used for handling memory buffers; the name is thus something of a misnomer. Functions declared in string.h are extremely popular since, as a part of the
C standard library, they are guaranteed to work on any platform which supports C. However, some security issues exist with these functions, such as potential
buffer overflows when not used carefully and properly, causing the programmers to prefer safer and possibly less portable variants, out of which some popular ones are listed below. Some of these functions also violate
const-correctness by accepting a const string pointer and returning a non-const pointer within the string. To correct this, some have been separated into two
overloaded functions in the C++ version of the standard library.
Constants and types Functions Multibyte functions These functions all need a object, originally in static memory (making the functions not be thread-safe) and in later additions the caller must maintain. This was originally intended to track shift states in the encodings, but modern ones such as UTF-8 do not need this. However these functions were designed on the assumption that the encoding is not a
variable-width encoding and thus are designed to deal with exactly one at a time, passing it by value rather than using a string pointer. As UTF-16 is a variable-width encoding, the has been reused to keep track of surrogate pairs in the wide encoding, though the caller must still detect and call twice for a single character. Later additions to the standard admit that the only conversion programmers are interested in is between UTF-8 and UTF-16 and directly provide this.
Numeric conversions The C standard library contains several functions for numeric conversions. The functions that deal with byte strings are defined in the header ( header in C++). The functions that deal with wide strings are defined in the header ( header in C++). The functions , , , , , and their wide counterparts are not
const-correct, since they accept a string pointer and return a non- pointer within the string. This has been fixed in
C23. Also, since the Normative Amendment 1 (C95), functions are considered subsumed by functions, for which reason neither C95 nor any later standard provides wide-character versions of these functions. The argument against is that they do not differentiate between an error and a . ==Popular extensions==