strtok
strtok
from C++ freestanding, because C2X freestanding no longer includes strtok
in C freestanding.
strtok
was added to C++ freestanding as part of P2338R4 (Freestanding Library: Character primitives and the C library).
P2338R0 and P2338R1 did not include strtok
, as strtok
uses global storage that is difficult to synchronize in freestanding environments.
(In practice, freestanding environments aren't guaranteed to have storage that is local to a thread, mutexes, or atomics larger than atomic_flag
).
In P2338R2 only added strtok
because C2X added strtok
to C freestanding.
In C2X CD2, C removed strtok
from C freestanding.
Now that strtok
doesn't aid in C compatibility, C++ can now remove strtok
from C++ freestanding.
Even though strtok
is not required to avoid data races, good implementations do so.
Freestanding shouldn't encourage implementations to provide poor implementations.
Please update the value of the __cpp_lib_freestanding_cstring
feature test macro.
#define __cpp_lib_freestanding_cstringold-valnew-val // freestanding, also in <cstring>
char* strstr(char* s1, const char* s2); // freestanding, see [library.c] char* strtok(char* s1, const char* s2);// freestandingvoid* memset(void* s, int c, size_t n); // freestanding