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][AArch64] Optimized memcpy/memmove


> Zack Weinberg wrote:
> Making memcpy the same as memmove is dangerous because then people
> will fail to notice when they *should* have used memmove.  If you do
> anything at all, detect an overlap and call abort().

Many memcpy implementations already behave like memmove for sizes smaller
than ~256 bytes, so combining them would not significantly increase the
danger. The behaviour of memcpy on overlaps is undefined, so it's reasonable
to do whatever happens to be fastest and do the additional checks in debug
libraries/sanitizers (oddly enough memcpy_chk does not check for overlaps).

Wilco



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