Web lists-archives.com

Re: [Mingw-users] errno_t and strerror_s




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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[1], as *optional*, in Annex-K.

[1] 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().

- -- 
Regards,
Keith.

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)

iQIcBAEBAgAGBQJYQKyAAAoJEMCtNsY0flo/7toP/1xzxde8EQl5IRjbS9UMcxYf
k4MiQazct2vgw2gRgnMhK+OurAxlGzK5ODv350fu5mmcZz4nwIBk7sG0GE54wvsM
ScDo8IE3Q/SLxgD17zQ4ie4htmrPJJSjC9TMB/9f6hUwgk9Upx8eRWsUrTP5den3
Foqi1tNTJAJHki+2MrrT3e393ZFhpYAVvDkp77IaeoaWa3XdtC6OyPIwztD5EkR7
3eEryASFS5AWvD4REuF2Ja7OFOBuuN26BzlAV6J7md6Alk00N1RW8T5c4MnmdGHd
60Xuy2HnFf9pVnydVEoDtFWe4GkqE2Ih76F6YN/PGYpxi2OiEEsGP2Sod5MATNEY
aKCfDfdaEswlMtk5epGoPhJnO7sJSPqHfqP72Gp5nVON3sQiBRKK/pqnOM3h8n42
sHuaFdF/qhctM+IUqV26h+oZrFUoEoelTdRmVzmTJ27uUvDC5ZFg4UFPb/ZVanoE
4uLfklrKqoODYvR/fJgY+NkO1nu8z2JoL8LZ43ir7iQUNs6WQJKI4grD/JtJvHK+
E8br6iN7ScR9JFqEazbRNL841NgQshHFaRAi0/3aOTa2C0VPIQ7LMsm0nm3sdRAZ
hnOhyKHy4rG8TBN4jjVTvRs2mPbpQNznifppG6lbi1Ckbi+2gGufxLNLEeYIpn0K
fg6WwuQprEzion8NFGf7
=ZRYN
-----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
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
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:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe