Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic


Microsoft Specific

Applied to a function declaration or definition that returns a pointer type and tells the compiler that the function returns an object that will not be aliased with any other pointers.

__declspec(restrict) return_type f();

The compiler will propagate __declspec(restrict). For example, the CRT malloc function is decorated with __declspec(restrict) and therefore, pointers initialized to memory locations with malloc are also implied to not be aliased.

The compiler does not check that the pointer is actually not aliased. It is the developer's responsibility to ensure the program does not alias a pointer marked with the restrict __declspec modifier.

For similar semantics on variables, see __restrict.

See noalias for an example using restrict.

END Microsoft Specific

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.