This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Do not call memmove when memcpy suffices.
- From: Roland McGrath <roland at hack dot frob dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 25 Oct 2013 15:24:08 -0700 (PDT)
- Subject: Re: [RFC] Do not call memmove when memcpy suffices.
- Authentication-results: sourceware.org; auth=none
- References: <20130813111123 dot GA1623 at domone dot kolej dot mff dot cuni dot cz>
The sole purpose of the memmove function is to support the possibility of
overlap. If the programmer knows there is no possibility of overlap, then
they should just use memcpy. (Of course, _FORTIFY_SOURCE checks for
overlap in memcpy would be a very wise thing to have.) If anything, the
only thing that should be done with a macro or inline for memmove is to
transmute it to memcpy when it is determinable at compile time that there
is no possibility of overlap. Anything requiring run-time detection should
be done in the memmove implementation itself.