Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #68316
| From | Manfred <noname@add.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: standard error messages in a std::string or in a const char * |
| Date | 2019-09-11 14:56 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <qlaque$lqm$1@gioia.aioe.org> (permalink) |
| References | (3 earlier) <qlacv3$1d1o$1@adenine.netfront.net> <lnzhjbcgx0.fsf@kst-u.example.com> <qlafs8$9li$1@news.albasani.net> <f2062d7c-ca42-4856-85a2-d59f5d9ab23b@googlegroups.com> <qlap77$dmo$1@dont-email.me> |
On 9/11/2019 2:27 PM, James Kuyper wrote: > On 9/11/19 7:43 AM, Öö Tiib wrote: >> On Wednesday, 11 September 2019 12:48:03 UTC+3, Bonita Montero wrote: >>> There's strerror_r, which is thread-safe. >> >> Somewhere there is strerror_r but not in C++ standard. ... > > Such a function is specified by POSIX, which doesn't help those > targeting non-POSIX systems. > >> ... In C++ standard >> there was added strerror_s by C++11 but it may be is deprecated again. > > It is still mentioned in N4659.pdf, dated 2017-03-01. It is described in > 20.1.5.2p10 as a carry-over from C. There is no other description, > you're supposed to cross-reference the C standard for that. > > The description of sterror_s() in the C standard (C11 K3.7.4.2) does > not, itself, say anything about threads. It simply lacks any clause > comparable to the one in the description of sterror() description which > says "The strerror function is not required to avoid data races with > other calls to the strerror function." (C11 7.24.6.2p3). That's > sufficient, since "Unless explicitly stated otherwise in the detailed > descriptions that follow, library functions shall prevent data races." > (C11 7.1.4p5). > > Just in case you didn't notice that omission, footnote 312 on the > description of strerror() says "The strerror_s function can be used > instead to avoid data races.". > strerror_s is indeed part of annex K, which has become more and more controversial, and some implementations (notably glibc) do not support it. However, a good indication that it is thread safe comes from its interface: instead of returning a pointer to an internal string buffer, it requires a writable buffer to be provided by the caller.
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