* Errors in two Section 3 functions
@ 2025-11-02 15:47 Rick Stanley
2025-11-02 17:42 ` Alejandro Colomar
0 siblings, 1 reply; 2+ messages in thread
From: Rick Stanley @ 2025-11-02 15:47 UTC (permalink / raw)
To: Alejandro Colomar; +Cc: linux-man
Hello!
I have noticed two errors for memmove() and memcpy().
memmove():
man7.org:
"void *memmove(size_t n;
void dest[n], const void src[n], size_t n);"
string.h:
"extern void *memmove (void *__dest, const void *__src, size_t __n)"
(Leaving off the __THROW text)
memcpy()
man7.org:
"void *memcpy(size_t n;
void dest[restrict n], const void src[restrict n],
size_t n);"
string.h:
"extern void *memccpy (void *__restrict __dest, const void *__restrict
__src, int __c, size_t __n)"
The issue in both is:
"memmove(size_t n;"
"memcpy(size_t n;"
IMHO on man7.org, they should read:
"void *memmove(void dest[n], const void src[n], size_t n);"
"void *memcpy(void dest[restrict n], const void src[restrict n],
size_t n);"
Thanks!
Rick
--
Rick Stanley
(917) 822-7771
www.rsiny.com
IT Consulting
Linux & Open Source Specialist
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Errors in two Section 3 functions
2025-11-02 15:47 Errors in two Section 3 functions Rick Stanley
@ 2025-11-02 17:42 ` Alejandro Colomar
0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar @ 2025-11-02 17:42 UTC (permalink / raw)
To: Rick Stanley; +Cc: linux-man
[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]
Hi Rick,
On Sun, Nov 02, 2025 at 10:47:47AM -0500, Rick Stanley wrote:
> Hello!
>
> I have noticed two errors for memmove() and memcpy().
>
> memmove():
>
> man7.org:
> "void *memmove(size_t n;
> void dest[n], const void src[n], size_t n);"
> string.h:
> "extern void *memmove (void *__dest, const void *__src, size_t __n)"
> (Leaving off the __THROW text)
>
>
> memcpy()
>
> man7.org:
> "void *memcpy(size_t n;
> void dest[restrict n], const void src[restrict n],
> size_t n);"
>
> string.h:
> "extern void *memccpy (void *__restrict __dest, const void *__restrict
> __src, int __c, size_t __n)"
>
> The issue in both is:
> "memmove(size_t n;"
> "memcpy(size_t n;"
That's not an error; it's valid GNU C.
> IMHO on man7.org, they should read:
>
> "void *memmove(void dest[n], const void src[n], size_t n);"
>
> "void *memcpy(void dest[restrict n], const void src[restrict n],
> size_t n);"
That would be incorrect. You can't use a variable before declaring it.
See <https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html>.
Have a lovely night!
Alex
--
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-02 17:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-02 15:47 Errors in two Section 3 functions Rick Stanley
2025-11-02 17:42 ` Alejandro Colomar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).