Re: Error in manual page memcpy(3)
Alejandro Colomar <[email protected]> Thu, 4 Jun 2026 13:03:03 +0200
| Newsgroups | org.kernel.vger.linux-man |
|---|---|
| Message-ID | <aiFagMMoVEGdlJop@devuan> |
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>
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmohW2YACgkQ64mZXMKQ wqnM5g//fhrzZbBCWRzKDgImGntzJcgu7on1Ttmpf+JvA9xwuz9a0r+g4HqMFuCf S0Ad2z0DRRM+AJFn9gUDGet+kYvWW0sob/4Rt/VGd5y4sERTTd/G+G6ve9+QJzlY 397qCHJqKDmU9zAnD+k3+uAWF/cZQKLC5yIYh4Ml7oFxavamVXEVO8qh8XeTfI3o UT51DOKv7JirKH61R7znaAQ3q0xEpzReEOkAf9pAHFRsQo97TwHpAd7XjN1nQKx5 6lMNKCCSrQjHOOAR7ZoItXOvmloliW1VF0d2e3oI3S8Ab0571zBRsjH/b7AVk6HX FNvj8+UJ2tULfWDH9EgoEdAQ0gBpyoueM1tuHwbG9cGkxy6bFuuf75Dv+K/waK8N x6ZKbvKjg10HLHdVuxtmTSfSQegsK++Scl0RZF1/6LOpZaJZZRDHapdcmNpyo1v9 H1H0+vKDHBjvXUK4nPJKwzGtqKiJbQUMHObCi5JxFU7/0TkQaCpBVHDx4sriKf2T qR/qBPHRh4PspW+zjbGn2InhwaUFKp8rlkdlBhUzOnzM+/4nPaYaSFr3r9Ws+typ XPVtEyfkkwQ86k2bYrp32yNmL0QHw06976POecDvBeTNG+JCtRXOXEMzhV+qb5W+ UDr2Vuws6pxbZ3mz1HCMsVgxz0W/AfegLE8wsgeTBxRUf4ADMbo= =QcZb -----END PGP SIGNATURE-----