3 ms·
The requirements for memcpy, memmove, memset and memcmp stem from the fact that statements like "char arr[100] = {0};" or "struct somestruct some_a = some_b;" c
by mid-kid 5y ago
The requirements for memcpy, memmove, memset and memcmp stem from the fact that statements like "char arr[100] = {0};" or "struct somestruct some_a = some_b;" cause implicit memsets and memcpys, in cases where it can't be handled within less instructions.
These functions are required by the freestanding part of the C standard, too, anyway.
- matheusmoreira 5y ago> implicit memsets and memcpys, in cases where it can't be handled within less instructions Yeah, I know. Still, I expected GCC to generate code like this in freestanding environments. There is no standard library so the compiler should not implicitly emit any calls to standard library functions at all. That ought to have freed me to do whatever I want, including implementing those functions differently or with different names. > These functions are required by the freestanding part of the C standard, too, anyway. What? If I remember correctly, only a very small list of headers are required in freestanding environments and string.h was not among them.