This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] Should strtok_r be preferred to strtok?
- From: Ulrich Drepper <drepper at redhat dot com>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: libstdc++ at gcc dot gnu dot org, Roland McGrath <roland at redhat dot com>, Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
- Date: Mon, 25 Nov 2002 12:51:43 -0800
- Subject: Re: [RFC] Should strtok_r be preferred to strtok?
- References: <3DE2890E.1080509@unitus.it>
-----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-----