Linux Manual Pages development
 help / color / mirror / Atom feed
* Re: Error in manual page memcpy(3)
       [not found] ` <e53068f4-2541-4220-8571-47e3283bb01f@netscape.net>
@ 2026-06-04 11:03   ` Alejandro Colomar
  0 siblings, 0 replies; only message in thread
From: Alejandro Colomar @ 2026-06-04 11:03 UTC (permalink / raw)
  To: Siegfried Ehlert; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

Hi Siegfried,

On 2026-06-04T12:14:08+0200, Siegfried Ehlert wrote:
> An error has crept into the synopsis of the *memcpy(3)* manual page.
> Immediately after the opening bracket of the function name, the third
> argument is listed as "size_t n;". The same applies to the strncpy(3) and
> stpncpy(3) manual pages; there, too, the third argument appears immediately
> after the opening bracket.
> 
> *Example:
> *
> 
> 
>    SYNOPSIS
> 
> *#include <string.h>* *void *memcpy(*size_t n; *void */dest/*[restrict
> */n/*], const void */src/*[restrict */n/*],* *size_t */n/*);*

That's correct.

     void *memcpy(size_t n;
                  void dest[restrict n], const void src[restrict n], size_t n);

What you're seeing is a forward declaration of the third parameter.
This is necessary so that it can be used in the array length expressions
in the declarators of the first and second parameters, since the third
parameter hasn't been declared yet.  This is an old GNU extension, and
is documented at the bottom of this page of the GCC manual:
<https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html>


Have a lovely day!
Alex

> 
> Kind regards
> Siegfried

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-04 11:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <e53068f4-2541-4220-8571-47e3283bb01f.ref@netscape.net>
     [not found] ` <e53068f4-2541-4220-8571-47e3283bb01f@netscape.net>
2026-06-04 11:03   ` Error in manual page memcpy(3) Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox