the Linux man-pages as an educational tool

Alejandro Colomar alx@kernel.org
Sun Aug 2 21:34:40 GMT 2026


Hi Maciej,

> Date: 2026-08-02 22:23:36+0100
> From: "Maciej W. Rozycki" <macro@orcam.me.uk>
>
> 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>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260802/63af326d/attachment.sig>


More information about the Libc-alpha mailing list