News for hackers. Stuff that matters.
Re:C Strings and my slow descent to madness by asveikau on Friday April 07, 2023 @01:19AM (#35478306)
Gcc and clang are relevant here because memcpy is a builtin. It will not call libc for this.

Same is true of MSVC.

It's been that way on most modern compilers for about 20 years.

That's why I'm saying rolling your own may be futile. Compilers, not just libc, have paid a lot of attention to getting those things fast.

Re:C Strings and my slow descent to madness by stephc_int13 on Friday April 07, 2023 @08:20AM (#35480817)
What is true for memcpy (especially on small buffers) is not systematically true for string functions.

But testing is always there to the rescue, and these days we have Godbolt.