Re: proposed revision to memory.h(3head)

Mark Harris <[email protected]> Mon, 3 Aug 2026 13:14:35 -0700
Newsgroups org.kernel.vger.linux-man
Message-ID <CAMdZqKH1=20mAxRR0-F+Pf4EXv57Nchr1TSwe_5CsEaEKp00rQ@mail.gmail.com>
Alejandro Colomar wrote:
>         SYNOPSIS
>              #include <memory.h>  // See STANDARDS

intro(3) implies that the SYNOPSIS section intends to reflect the
function's API; i.e., the interface that it has agreed to provide to
applications.  Do you disagree?

If strndup(3)'s SYNOPSIS stated "int" instead of "size_t" for the
second argument, it may work fine in many cases but that is not the
API that it has agreed to provide so it is inaccurate.  Similarly if
it states "memory.h" instead of "string.h", even if it happens to work
on some systems, that is not the API it has agreed to provide so it is
inaccurate.  If memory.h ceases to provide a usable declaration for
strndup(), that is the problem of the person that relied on the
inaccurate information because there was never any agreement to
provide a usable declaration of strndup() in memory.h; they should
have used a reliable source to determine the API that is actually
supported.  I am having trouble figuring out where you disagree with
this seemingly-straightforward logic.


 - Mark