That raises another interesting question: Are there any
platforms that define both their C and C++ standard libraries
on top of a shared subset, rather than just providing C++
aliases for old C?
There are probably some, but in many cases, the C library is
bundled with the system.
For example, are there any implementations that just forward
both memcpy and (sometimes) std::copy to an internal
__inline_memcpy?
I always thought that the usual implementation of memcpy in the
C header was something like:
extern void* memcpy( void* dest, void const* src, size_t n ) ;
#define memcpy( dest, src, n ) __builtin_memcpy( dest, src, n )
(But of course, this causes problems when the library is bundled
as well.) And of course, since it is a template, the compiler
can already see all of the code for std::copy, and optimize
accordingly.
Of course, this is only valid for simple functions like memcpy.
I can't imagine any implementation using a compiler builtin for
something like strftime.