Posted Nov 25, 2010 20:59 UTC (Thu) by kleptog (subscriber, #1183)
In reply to: On breaking things by iabervon
Parent article: On breaking things
Doing memory copies on buffers that overlap is exceedingly rare. As a library it's something you really don't need to worry about. If you're writing code and can't tell if two pointers could overlap, you're doing something wrong.
Another way to look at it is that programs consist of objects. Objects don't overlap because you allocate them that way (they may nest). About the only situation where you do a memory copy on overlapping buffers in when you're shifting objects within an array, and there it's *obvious* that's what you're doing.
It's really not a situation you get into by accident. Deoptimising the common case to save the 0.00000001% (which is an estimate on the high side) of memcpys that are broken is just silly. Valgrind detects this for you, this is really a non-issue.