Re: the Linux man-pages as an educational tool
Alejandro Colomar <[email protected]> Sun, 2 Aug 2026 23:34:40 +0200
| Newsgroups | gmane.linux.man,gmane.comp.lib.gnulib.bugs,gmane.comp.lib.glibc.alpha |
|---|---|
| Message-ID | <am-2d02e1qq78Asv@devuan> |
Hi Maciej, > Date: 2026-08-02 22:23:36+0100 > From: "Maciej W. Rozycki" <[email protected]> > > What problem are you trying to fix anyway, what's wrong with > using <string.h> for the APIs in question? Programmers misunderstand these functions (some more than others), and think they are appropriate for handling strings in ways that they are inappropriate. If <string.h> was described as providing functions that exclusively handle strings, then programmers that only need to handle strings would naturally self-limit to functions from this header file. Those programmers that need more niche memory functions --maybe because they need to handle a substring, or maybe because they need to handle a utmp(5) fixed-width null-padded character array-- can resort to <memory.h>, but that comes with the implied warning that those functions are not the simple interfaces that <string.h> probides; they are sharper: you can do more with them, but you need to be more careful. Most programmers can live in the safe bubble of <string.h>: those functions always require a string as input, and always provide a string as output. Plain and simple. It's difficult to write bugs when using those. That's the rationale. Have a lovely night! Alex > > Maciej -- <https://www.alejandro-colomar.es>
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmpvt+oACgkQ64mZXMKQ wqnsFRAAmh6lhP/G7x0QI9eH97AyMg814jLxZPuaofNbqLhUIoD2vpqjP5HvWlIV 2T0KU54So4Wx6T9gcMwmYo4NbubkyMQknAbTvl14U5/TpiMUydE29PTb4lfKO4m1 kJgwOOoqZEWGUR4HoJ2qoN8KYJ/U/uyeU+Oj6Hsy7TvzDgsg6H8IW3YA8vFSrG4b wZXqHpzSFOih4AgS7xyaJ3H3xfvMea7nnTFHLD5KW9ecD41Y2mvW6u0NiOLl2jgq uYKnXiuaRAk5HmUZSDmne2ECC2hCWWjOFdQ/jr/+eNTTOhmA5N9bZP9Rg4uQpGP3 2OjF00lY0t/XVMMaxS8KCs5rKu9iYEij77fsf0h+lw3UgibiwZp75q/Qo9IRdCN1 Az4baWj0Wre0GHf1my44Lq/s8QAlCsnI9+ISoQuMpq9/3yU7Eu0rDVWGnEbXTG0n 0o2q041Hh5GXWlS0vhvJ1PPPaXOx7KX08Hlpmj3de75hiUOJMmBPyIvOihcAhFJY +eN7L97wGwz20ehjFLujYYphkk7V7HidjvUJH8mReetI8T5+gFgKZ0b7txOOyr9F +Qbpo79VH7KYQoPCIDMsXere8WtxykkdfqDPIhDtSUsZhqEmWzM0iKzAUiE7HdaH sDIxkyOJUbAExdVzkgD8cFF+pqdH+MhDV6c0kKPGqiV5GcF8W/U= =UEWm -----END PGP SIGNATURE-----