Developer Guide and Reference

Contents

fprotect-parens, Qprotect-parens

Determines whether the optimizer honors parentheses when floating-point expressions are evaluated.

Syntax

Linux and macOS:
-fprotect-parens
-fno-protect-parens
Windows:
/Qprotect-parens
/Qprotect-parens-
Arguments
None
Default
-fno-protect-parens
or
/Qprotect-parens-
Parentheses are ignored when determining the order of expression evaluation.
Description
This option determines whether the optimizer honors parentheses when determining the order of floating-point expression evaluation.
When option
-fprotect-parens
(Linux* and
macOS*
) or
/Qprotect-parens
(Windows*) is specified, the optimizer will maintain the order of evaluation imposed by parentheses in the code.
When option
-fno-protect-parens
(Linux* and
macOS*
) or
/Qprotect-parens-
(Windows*) is specified, the optimizer may reorder floating-point expressions without regard for parentheses if it produces faster executing code.
Alternate Options
None
Consider the following expression:
A+(B+C)
By default, the parentheses are ignored and the compiler is free to re-order the floating-point operations based on the optimization level, the setting of option
-fp-model
(Linux* and
macOS*
) or
/fp
(Windows*), etc. to produce faster code. Code that is sensitive to the order of operations may produce different results (such as with some floating-point computations).
However, if
-fprotect-parens
(Linux* and
macOS*
) or
/Qprotect-parens
(Windows*) is specified, parentheses around floating-point expressions (including complex floating-point and decimal floating-point) are honored and the expression will be interpreted following the normal precedence rules, that is, B+C will be computed first and then added to A.
This may produce slower code than when parentheses are ignored. If floating-point sensitivity is a specific concern, you should use option
-fp-model precise
(Linux* and
macOS*
) or
/fp:precise
(Windows*) to ensure precision because it controls all optimizations that may affect precision.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804