There is a version of C99/posix memcpy
function in GCC: __builtin_memcpy
.
Sometimes it can be replaced by GCC to inline version of memcpy and in other cases it is replaced by call to libc's memcpy. E.g. it was noted here:
Finally, on a compiler note, __builtin_memcpy can fall back to emitting a memcpy function call.
What is the logic in this selection? Is it logic the same in other gcc-compatible compilers, like clang/llvm, intel c++ compiler, PCC, suncc (oracle studio)?
When I should prefer of using __builtin_memcpy over plain memcpy?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…