Re: [PATCH 1/2] man/man3/{mem,strn}*(): SYNOPSIS, STANDARDS: Document these as provided by <memory.h>

Alejandro Colomar <[email protected]> Sat, 1 Aug 2026 00:33:12 +0200
Newsgroups org.kernel.vger.linux-man
Message-ID <am0h6_aBF2iEvpu5@devuan>
--u52srvamseyyv3op
Content-Type: text/plain; protected-headers=v1; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
From: Alejandro Colomar <[email protected]>
To: Joseph Myers <[email protected]>
Cc: [email protected], Keith Bostic <[email protected]>, 
	Mark Harris <[email protected]>, Nevin Liber <[email protected]>, 
	JeanHeyd Meneide <[email protected]>, Christopher Bazley <[email protected]>, 
	"Serge E. Hallyn" <[email protected]>, Iker Pedrosa <[email protected]>, 
	"Evgeny Grin (Karlson2k)" <[email protected]>, Kees Cook <[email protected]>, [email protected], 
	[email protected]
Subject: Re: [PATCH 1/2] man/man3/{mem,strn}*(): SYNOPSIS, STANDARDS:
 Document these as provided by <memory.h>
Message-ID: <am0h6_aBF2iEvpu5@devuan>
References: <[email protected]>
 <784288e704183a4297aeaa3d13af8edab18bc1ea.1785532392.git.alx@kernel.org>
 <[email protected]>
 <am0ax4Oe6--0Deco@devuan>
 <[email protected]>
MIME-Version: 1.0
In-Reply-To: <[email protected]>

Hi Joseph,

> Date: 2026-07-31 22:16:14+0000
> From: Joseph Myers <[email protected]>
>
> On Sat, 1 Aug 2026, Alejandro Colomar wrote:
>=20
> > That's 37 years.  During these 37 years we have gathered a lot of
> > experience and data about this.  And the conclusion is that it was
> > a huge mistake.  Programmers have struggled to understand this, and
>=20
> No, there's no such conclusion.  Two functions, strncpy and strncat, are=
=20
> with hindsight confusing (but it's the names and semantics rather than th=
e=20
> header that are confusing).

Those are the most misused, indeed.

>  I don't think there's any kind of community=20
> consensus at all that there's any problem with mem* being in <string.h>,=
=20
> or any functions other than those two.

But it's a consistent solution that keeps all existing functions (thus,
not a breaking change), and puts them in a header file that is
appropriate (and which has been their header since 1986).

> The committee writing C89 had to come up with a compromise between=20
> functions such as memcpy and strchr and functions such as bcopy and index=
=2E =20
> They chose to adopt memcpy and strchr,

This was a good choice.  mem*() were more portable back then.

> and chose to put them in=20
> <string.h>,

This wasn't a good choice.  They were already in <memory.h> in existing
systems.

> and there's no evidence since then to suggest a problem with=20
> either choice.

We disagree.


Cheers,
Alex

--=20
<https://www.alejandro-colomar.es>

--u52srvamseyyv3op
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmptIqMACgkQ64mZXMKQ
wqkgIw//YZrXoP8T3hdgRvd3mLy00t4tYe0KQbAlv06JqfO/5DdRrV6bkX2L+HVM
g1CiVU7OoMBgII4UZVbPWGYFknM/+ednzUzRn6axVKpkw022gmMRnuT751gssH/z
bReFD8XdyWWr1pc/CnPJLoBTnq+imZyJLi91r98lX+IQ58RjO+4Zn84SwpOea7Lc
CIM+UT+qVSVfIgzX7s582qujydRhsFqa/ppY6j5DD0U4iAiIfO8nbAgZknbo2vwp
TjEQdo08uLe6whtuFPn+6NxyZCekK0RP+RfzUSHo/k2IfQyE0opt8vVbGmPGpCDw
vO3QfVD93vyGCj3YuzFXMWnWrZhmM5+tdns42pQYIQU9NCmXa9B2/OP3YVjBRQtP
T3wR24Gn4m8CqSFwa+UleClpXApoXytrev2haprhuUqWDo1raZ4i48X9qzQKbFoM
nogNLSe9TIeGGwkUcQSODKQJ8ozRTRl/JyPdLFeL1lF7hkWlkmo4I2kMwWpidaF3
dqPKEs/HGjkcgQXkEn74mqaLu/jtqovPp8DCwTSg/N4lVJHxiAoRKVCbRG6McBV9
2T69knm8D5kyXgKFLU28vPi1t/BtSyoS7OBKOs2mizx8YDnEaI1xNGMFu06ouMGV
PURxuu7Ky48Re+20LAbNW5pmK0R+bXIYVWlRqk/YSLtSFdzsmcQ=
=Rzxw
-----END PGP SIGNATURE-----

--u52srvamseyyv3op--