RESTRICT | NORESTRICT (C only)

Category

Optimization and tuning

Pragma equivalent

None.

Purpose

Indicates to the compiler that no other pointers can access the same memory that has been addressed by function parameter pointers.

Syntax

Read syntax diagramSkip visual syntax diagramNORESTRICTRESTRICT( ,function_name )

Defaults

NORESTRICT

When NORESTRICT is in effect, no function parameter pointers are restricted unless the restrict attribute is specified in the source.

Parameters

function_name is a comma-separated list. If you do not specify the function_name, parameter pointers in all functions are treated as restrict. Otherwise, only those parameter pointers in the listed functions are treated as restrict.

Usage

The RESTRICT option indicates to the compiler that pointer parameters in all functions or in specified functions are disjoint. This is equivalent to adding the restrict keyword to the parameter pointers within the required functions, but without having to modify the source file. When RESTRICT is in effect, deeper pointer analysis is done by the compiler and performance of the application being compiled is improved.

Note that incorrectly asserting this pointer restriction might cause the compiler to generate incorrect code based on the false assumption. If the application works correctly when recompiled without the RESTRICT option, the assertion might be incorrect. In this case, this option should not be used.
Note: When RESTRICT and NORESTRICT are specified multiple times, the last option specified on the command line takes precedence over any previous specifications.

The usage status of this option is inserted in the object file to aid you in diagnosing a problem with your program.

Predefined macros

None.