On Tuesday 13 December 2005 13:26, Hardy Griech wrote: > Neil Wyper wrote: > > Your modified memcpy works for most situations, but doesn't handle > > overlapping arrays properly, if src < dst. If the arrays overlap, then > > the copy to dst will overwrite the end of src before it is copied. This > > is why the libc memcopy has a block for "copy backwards" if src < dst. > > memcpy() does not make any guarantees about averlapping areas. > Overlapping areas are a task of memmove(). >
Good point. Considering that, I agree with Daniel that the mspgcc memcpy is overdone. If memcpy, memmove and bcopy are all used, then three copies of the same code are compiled and linked in (with the exception of the return statement for bcopy). Why not get the same behaviour using macros, instead? #define memcpy(src,dst,len) memmove(src,dst,len) etc If all three names are used, at least only one block of code is created. Neil