On 9/13/06, Steve Hosgood <[email protected]> wrote:
A thought... is it a valid optimisation to replace a routine like 'memcpy', assuming that 'memcpy' is the one from <stdio.h>? What if the user wrote his own 'memcpy' routine to do something magic and then wondered why it didn't get called?
I think it is valid. memcpy has a standard behaviour across any compiler, so each compiler should be free to optimize it for the best performance, while maintaining the standard behaviour. If you really want to use a custom memcpy, you can use GCC command line arguments to disable all or specific built-in functions: -fno-builtin or -fno-builtin-memcpy (from http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/C-Dialect-Options.html). That still requires the programmer to realize that his custom memcpy was being replaced automatically by a built-in function, though.
