-qrestrict (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.

Specifying this option is equivalent to adding the restrict keyword to the pointer parameters within the specified functions, except that you do not need to modify the source file.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-norestrict-.                             
>>- -q--+-restrict---+--+----------------------+---------------><
                        |    .-:-------------. |   
                        |    V               | |   
                        '-=----function_name-+-'   

Defaults

-qnorestrict. It means no function pointer parameters are restricted, unless you specify the restrict attribute in the source.

Usage

If you do not specify the function_name, pointer parameters in all functions are treated as restrict. Otherwise, only those pointer parameters in the listed functions are treated as restrict.

function_name is a colon-separated list.

Using this option can improve the performance of your application, but 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 -qrestrict, the assertion might be false. In this case, this option should not be used.

Notes:

Predefined macros

None.

Examples

To compile myprogram.c, instructing the compiler to restrict the pointer access, enter:

bgxlc -qrestrict myprogram.c

Related information