[RFC] Should strtok_r be preferred to strtok?
Ulrich Drepper
drepper@redhat.com
Mon Nov 25 13:26:00 GMT 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Paolo Carlini wrote:
> Hi,
>
> Wolfgang Bangerth, in private mail, pointed my attention to the the
> issue of thread-safety for strtok(), which I blatantly used in the
> rewrite of locale::_Impl::_Impl(const char* __s, size_t __refs) for
> thread safe :-( Posix localenames...
>
> Should we autoconf for strtok_r and prefer it when available?
You definitely must not use strtok.
Check for strtok_r (which is POSIX) or strsep (also in glibc). Which
one you pick depends on your personal preferences.
- --
- --------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE94o1f2ijCOnn/RHQRAsEpAKDGZf9kPc+gHV0CWck8y5jw6u/WrgCePlOT
UCKsC1QH9kUwNFNCeDlopXI=
=N//Z
-----END PGP SIGNATURE-----
More information about the Libstdc++
mailing list