on the irresponsibility of pursuing C language reform
Alejandro Colomar
alx@kernel.org
Sat Aug 1 23:24:28 GMT 2026
Hi Keith,
> Date: 2026-08-02 00:44:46+0200
> From: Alejandro Colomar <alx@kernel.org>
>
[...]
> > Advocating for better usage in the documentation is a different thing, and
> > a good thing. The man pages can even go pretty hard, that’s their job:
> > “Notice the include file is string.h. That’s an historic accident
> > maintained for compatibility reasons; don’t let that fool you, this
> > function doesn’t operate on strings.”
>
[...]
> I should probably expand the NOTES a little bit, to be more clear about
> why we ignore the standard in the SYNOPSIS.
I've put that text in a centralized place, in the memory.h(3head) manual
page:
$ MANWIDTH=64 diffman-git HEAD
--- HEAD^:man/man3head/memory.h.3
+++ HEAD:man/man3head/memory.h.3
@@ -10,6 +10,11 @@ SYNOPSIS
#include <memory.h>
DESCRIPTION
+ These functions are also provided in <string.h>, as speci‐
+ fied by ISO C. This is a historic accident maintained for
+ compatibility reasons. Don’t let that fool you; these
+ functions don’t necessarily operate on strings.
+
Write
bzero(3)
memset(3)
@@ -38,6 +43,19 @@ DESCRIPTION
memrchr(3)
memmem(3)
+STANDARDS
+ BSD.
+
+HISTORY
+ The <memory.h> header file is the original one which was
+ added in System V (1983), and was later adopted by 4.3BSD
+ (1986). It contained the original mem* functions.
+
+ C89 didn’t standardize this header file, and instead
+ crammed all these functions in <string.h>, resulting in
+ confusing programmers about the real purpose of these
+ functions.
+
SEE ALSO
string(3), string_copying(7)
Cheers,
Alex
--
<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/ffb167e2/attachment.sig>
More information about the Libc-alpha
mailing list