The restrict
type qualifier is a guarantee by the programmer that there are no other pointers with access to the referenced object and
that the object does not overlap with any other object in memory. Its use may allow the compiler to generate more efficient byte code.
However, this is a tricky language feature to use correctly, and there is a significant risk of unexpected program behavior if
restrict
is misused. Therefore, restrict
should not be used.
Noncompliant code example
void user_copy (
void * restrict p, // Noncompliant parameter
void * restrict q, // Noncompliant parameter
size_t n
) {
// ...
}