Re: [PATCH v2] man/man3/mem*(): SYNOPSIS: Document non-standard mem*() functions as provided by <memory.h>

Bruno Haible via Gnulib discussion list <[email protected]> Sun, 02 Aug 2026 00:22:34 +0200
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.linux.man,gmane.comp.lib.glibc.alpha
Message-ID <3556566.BddDVKsqQX@cagnes>
Hi Alejandro,

All proposed ISO C changes need to be evaluated according to (at least)
these three dimensions:

  * Benefit (for the community of C programmers),
  * Cost of adoption (for the community of C programmers),
  * Consistency.

Your previous proposal "alx-0097r1 - <memory.h>, the legitimate header for
memcpy(3) et al." evaluates like this, IMO:
  * Benefit: Small.
  * Cost of adoption: Huge
    (there are more than 700000 references to memcpy() alone in Debian sour=
ces
    [1]).
  * Consistency: Reasonable (you have explained why strncpy is actually a "=
mem"
    function).

This proposal [v2] is no longer for ISO C, but =E2=80=94 if you want to tea=
ch the
community something by modifying the man pages =E2=80=94 needs to be evalua=
ted according
to the same criteria.
  * Benefit: None.
  * Cost of adoption: Moderate
    (because these 5 functions are not frequently used).
  * Consistency: Totally negative.
      - memmem() is a generalization of memchr(), therefore it belongs in t=
he
        same header file, namely <string.h>.
      - memrchr() is an analogue to memchr(), therefore likewise it belongs=
 in
        <string.h>.
      - mempcpy() is a variant of memcpy(), therefore likewise it belongs in
        <string.h>.
      - strndupa() is a variant of strndup() which is declared in <string.h=
>,
        therefore it belongs in <string.h> as well.

Please do us the favour to evaluate your proposals according to these
dimensions by yourself, before spreading them.

And, of course, for man page changes, consider the authoritative source.
=46or example, memfrob() exists only in glibc [2], therefore its authoritat=
ive
documentation is in the glibc manual [3], and it says "It is declared in
string.h." The man pages MUST say the same thing.

Thanks.

      Bruno

[1] https://codesearch.debian.net/search?q=3D%5Cbmemcpy%5Cb&literal=3D0
[2] https://gitweb.git.savannah.gnu.org/gitweb/?p=3Dgnulib/maint-tools.git;=
a=3Dtree;f=3Dplatforms/various-symlists
[3] https://sourceware.org/glibc/manual/2.44/html_node/Obfuscating-Data.html