This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Should strtok_r be preferred to strtok?


-----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-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]