3.3.3. restrict

The restrict keyword is a C99 feature that enables you to ensure that different object pointer types and function parameter arrays do not point to overlapping regions of memory. Therefore, the compiler performs optimizations that can be otherwise prevented because of possible aliasing.

Restrictions

To enable the restrict keyword in C90 or C++, you must specify the --restrict option.

The keywords __restrict and __restrict__ are supported as synonyms for restrict and are always available, regardless of whether --restrict is specified.

Example

void copy_array(int n, int *restrict a, int *restrict b)
{
    while (n-- > 0)
        *a++ = *b++;
}

See also

Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A
Non-Confidential