C++: Difference between calling memcpy and __builtin_memcpy
Martin Sebor
msebor@gmail.com
Mon Feb 15 02:21:00 GMT 2016
On 02/12/2016 04:55 AM, Florian Weimer wrote:
> For the C++ compilers version which recognize memcpy, is there a
> difference between calling memcpy via your own extern "C" declaration,
> and calling __builtin_memcpy?
Except in freestanding mode (with builtins disabled) I don't believe
there is a difference. They both get expanded the same way (either
inline or to a call to memcpy depending on arguments).
> What about calling memcpy through a function which has a "memcpy" asm alias?
I'm not sure what asm alias you have in mind. If attribute alias,
then In order to define one the aliased symbol must itself be defined
in the same translation unit as the alias. That precludes defining
an alias for memcpy.
Martin
More information about the Gcc-help
mailing list