Re: [Mingw-users] errno_t and strerror_s
-----BEGIN PGP SIGNED MESSAGE-----
On 01/12/16 21:22, DAVENPORT, MARC wrote:
> I was just wondering if there will ever be support for errno_t and
> non-standard strerror functions like strerror_s.
I will not be implementing them myself, but may consider patches,
if anyone cares enough to submit them.
> cppreference.com says they are part of C11 ...
Only insofar as they are proposed, as *optional*, in Annex-K.
 AIUI, proposed by Microsoft; widely criticised, and not widely
implemented, other than by Microsoft's compilers.
> ... and that they are included in string.h, but MinGW doesn't
> include them as of gcc 5.3.0 and mingwrt3.22.4 and w32api 3.18.2.
> Should they be included?
Since we don't define __STDC_LIB_EXT1__, they are not required.
> I realize errno_t should just be replaced by int ...
Yes; what is the point of yet another redundant alias for int?
> ... the functionality of strerror_s is useful in that it duplicates
> the error string. It could be replaced by strerror and strdup, but
> strdup is non standard non strict ansi.
Maybe not standard in ISO-C11, but required by POSIX.1; it's provided
by the implementation, so define _POSIX_C_SOURCE appropriately, (if
you are concerned about strict standards compliance), and use it.
> What should I use instead?
As described in ISO-C11 Annex-K, strerror() and strncpy() would yield
a better match for the behaviour of strerror_s().
Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)
-----END PGP SIGNATURE-----
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
MinGW-users mailing list
This list observes the Etiquette found at
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
You may change your MinGW Account Options or unsubscribe at: