This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use memcpy in memmove when possible


> On Thu, Sep 06, 2012 at 12:58:16PM -0700, Roland McGrath wrote:
> > Definitely do not insert an extra RETURN (dest). There's no reason
> > for that.
> > 
> > You should use tail calls for the memcpy invocations.  i.e.
> > 	return memcpy (dest, src, len);
> 
> We're looking at this exact issue in musl right now as part of
> incorporating the C99 restrict keyword across the library, and I would
> recommend being really cautious about using memcpy to implement
> memmove unless you know an asm version of memcpy is in use. If a C
> version of memcpy is used with restrict pointers, the compiler is free
> to reverse the loop as it sees fit; no assumptions can be made about
> the order in which copying will take place.

That is not a relevant issue for this context.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]