# fprotect-parens, Qprotect-parens

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

## Syntax

Linux: | -fprotect-parens -fno-protect-parens

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.

## IDE Equivalent

None

## Alternate Options

None

## Example

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.

Parent topic: Optimization Options

## See Also

fp-model, fp compiler option