2.2.1. 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 can perform optimizations that might otherwise be prevented because of possible aliasing.

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 the --restrict option.

Example

void func (int *restrict pa, int *restrict pb, int x)
{
	int i;
	for (i=0; i<100; i++)
		*(pa + i) = *(pb + i) + x;
}

See also

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0350A
Non-Confidential