Subject: Re: Performance of various memcpy()'s
To: Bang Jun-Young <email@example.com>
From: Perry E. Metzger <firstname.lastname@example.org>
Date: 10/29/2002 12:10:58
Bang Jun-Young <email@example.com> writes:
> Along with this change, I'd like to get rid of _DIAGNOSTIC stuff as well.
> I don't understand why there's such a pointer wraparound check, since
> the memcpy(3) clearily says "use memmove() for overlap case." It might
> be worth adding "if you're not sure, always use memmove()." comment
> to memcpy(3).
We put stuff like that in place so that people can catch bugs, like
using memcpy if you meant memmove. Believe it or not, people do make
mistakes. It is reasonable to want to have bug-detection mechanisms
available for those who want them.