Is it technically impossible to implement memcpy from scratch in Standard C?
问题 Howard Chu writes: In the latest C spec it is impossible to write a "legal" implementation of malloc or memcpy. Is this right? My impression is that in the past, the intent (at least) of the standard was that something like this would work: void * memcpy(void * restrict destination, const void * restrict source, size_t nbytes) { size_t i; unsigned char *dst = (unsigned char *) destination; const unsigned char *src = (const unsigned char *) source; for (i = 0; i < nbytes; i++) dst[i] = src[i];