Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #68333
| Newsgroups | comp.lang.c++ |
|---|---|
| Date | 2019-09-11 09:44 -0700 |
| References | <ql98g2$8tf$1@dont-email.me> <ql98je$8tf$2@dont-email.me> <slrnqnhc2b.cdo.grahn+nntp@frailea.sa.invalid> <qlacv3$1d1o$1@adenine.netfront.net> <lnzhjbcgx0.fsf@kst-u.example.com> |
| Message-ID | <2bebb9ce-bdd4-41e0-a773-4e1c2da0ed3e@googlegroups.com> (permalink) |
| Subject | Re: standard error messages in a std::string or in a const char * |
| From | Thiago Adams <thiago.adams@gmail.com> |
On Wednesday, September 11, 2019 at 6:37:40 AM UTC-3, Keith Thompson wrote: > Juha Nieminen rites: > > Jorgen Grahn wrote: > >>> https://linux.die.net/man/3/strerror > >>> > >>> maybe will work ... > >> > >> It will do what the documentation says, and lots of people use it. > >> Note its limitations, though. It's not thread-safe, for example. > > > > What do you mean it's not thread-safe? AFAIK errno is thread-local > > according to the standard. > > errno is thread-local. That doesn't necessarily mean that strerror() > is thread-safe. For example, a conforming implementation could > always return a pointer to the same static buffer, initialized > with the appropriate message before it returns. And at least one > implementation (x86_64-w64-mingw32-gcc) appears to do exactly that. > > N1570 7.24.6.2p3: > > The strerror function is not required to avoid data races with > other calls to the strerror function. The implementation shall > behave as if no library function calls the strerror function. > I recently came across this subject as well and I was wondering why strerror is not thread safe. The answer I gave to myself is that is probably because it uses locales. It is just a guess.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
standard error messages in a std::string or in a const char * Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-11 00:35 +0200
Re: standard error messages in a std::string or in a const char * Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-11 00:37 +0200
Re: standard error messages in a std::string or in a const char * Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-09-11 08:28 +0000
Re: standard error messages in a std::string or in a const char * Juha Nieminen <nospam@thanks.invalid> - 2019-09-11 08:58 +0000
Re: standard error messages in a std::string or in a const char * Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-11 11:09 +0200
Re: standard error messages in a std::string or in a const char * Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-11 11:37 +0200
Re: standard error messages in a std::string or in a const char * Keith Thompson <kst-u@mib.org> - 2019-09-11 02:37 -0700
Re: standard error messages in a std::string or in a const char * Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-11 11:47 +0200
Re: standard error messages in a std::string or in a const char * Öö Tiib <ootiib@hot.ee> - 2019-09-11 04:43 -0700
Re: standard error messages in a std::string or in a const char * James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-09-11 08:27 -0400
Re: standard error messages in a std::string or in a const char * Manfred <noname@add.invalid> - 2019-09-11 14:56 +0200
Re: standard error messages in a std::string or in a const char * Daniel <danielaparker@gmail.com> - 2019-09-11 07:00 -0700
Re: standard error messages in a std::string or in a const char * Thiago Adams <thiago.adams@gmail.com> - 2019-09-11 09:44 -0700
Re: standard error messages in a std::string or in a const char * Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-09-12 10:21 +0000
Re: standard error messages in a std::string or in a const char * Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-12 13:05 +0200
Re: standard error messages in a std::string or in a const char * Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-11 17:43 +0200
Re: standard error messages in a std::string or in a const char * Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-11 19:23 +0300
Re: standard error messages in a std::string or in a const char * Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-11 19:19 +0200
Re: standard error messages in a std::string or in a const char * Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-11 20:32 +0300
Re: standard error messages in a std::string or in a const char * Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-12 13:08 +0200
Re: standard error messages in a std::string or in a const char * Thiago Adams <thiago.adams@gmail.com> - 2019-09-12 04:29 -0700
Re: standard error messages in a std::string or in a const char * Keith Thompson <kst-u@mib.org> - 2019-09-12 14:41 -0700
Re: standard error messages in a std::string or in a const char * Thiago Adams <thiago.adams@gmail.com> - 2019-09-11 10:39 -0700
Re: standard error messages in a std::string or in a const char * James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-09-11 19:50 -0400
Re: standard error messages in a std::string or in a const char * Keith Thompson <kst-u@mib.org> - 2019-09-11 17:11 -0700
Re: standard error messages in a std::string or in a const char * James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-09-11 20:23 -0400
Re: standard error messages in a std::string or in a const char * David Brown <david.brown@hesbynett.no> - 2019-09-12 11:21 +0200
Re: standard error messages in a std::string or in a const char * James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-09-12 07:31 -0400
Re: standard error messages in a std::string or in a const char * Manfred <noname@add.invalid> - 2019-09-12 15:44 +0200
csiph-web