In C, restrict qualifies a pointer and promises exclusive access to the object it designates during the relevant function execution. The compiler may use that promise when optimizing, but the caller must ensure it is true. section 16.2 section 16.5
memcpy versus memmove
The declarations make the contract visible:\n\nvoid *memcpy(void *restrict s1, void const *restrict s2, size_t n);\nvoid *memmove(void *s1, void const *s2, size_t n);\n\nFor memcpy, the accessed objects must not overlap, because both access paths require exclusivity. memmove makes no such assumption and therefore accepts equal or overlapping objects. section 16.2
Use restrict with these constraints in mind:
- Treat qualification as a constraint on the function caller, not merely as an optimization hint inside the function. section 16.2
- Ensure that each restrict-qualified access path provides exclusive access; violating the assumption makes the execution invalid. section 16.2
- Remember that aliasing analysis matters: restrict is especially relevant when the compiler must determine whether pointers designate the same object. section 16.2
void* memcpy(void*restrict s1, void const*restrict s2, size_t n); void* memmove(void* s1, const void* s2, size_t n);
Compare the restrict-qualified memcpy declaration with the unrestricted memmove declaration. section 16.2

