Re: [PATCH v2 1/2] libc: Make string.h POSIX.1-2024 compliant
John Scott <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Simon Barth wrote: > POSIX.1-2024 added strlcpy, strlcat, and memmem to strings.h. Previously these functions were only available as parts of BSD or GNU extensions. > Fix the header so that the symbol are visible for either the right extensions, or for POSIX.1-2024. This is a pedantic comment, but technically these functions do not have to be guarded behind feature test macros at all. Functions beginning with 'str' or 'mem' in <string.h> are in implementation-reserved namespace. I believe this provision goes back to C89. You can see it in a C17 draft at https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2310.pdf#nameddest=subsection.7.31.13 POSIX has always done the same: https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_02_02 As an example, POSIX provides that Annex K's string functions need not be guarded behind the __STDC_WANT_LIB_EXT1__ feature test macro.
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSiPzylvTnZ6xisfzWz9N0oYfTNugUCaRlJEQAKCRCz9N0oYfTN us5KAQDTNHlzQ6oNKMGCTDcPh9W8PxOiTxtW5eDt2FTq6rHTWwD+P9oGns1HOoXD +VbIPdQ2t74G/spRijKe8ryBE5zJIwI= =Fk19 -----END PGP SIGNATURE-----
smime.p7s
(application/pkcs7-signature, 6.1 KB) - not displayed