Implementation defined behavior control - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Implementation defined behavior control

From cppreference.com
< cpp‎ | preprocessor

Implementation defined behavior is controlled by `#pragma` directive.

### [edit] Syntax

`#pragma` pragma_params |  |

### [edit] Explanation

Pragma directive controls implementation-specific behavior of the compiler, such as disabling compiler warnings or changing alignment requirements. Any pragma that is not recognized is ignored.

### [edit] Standard pragmas

The following three pragmas are defined by the language standard:

`#pragma STDC FENV_ACCESS` arg | (1) |
`#pragma STDC FP_CONTRACT` arg | (2) |
`#pragma STDC CX_LIMITED_RANGE` arg | (3) |

where arg is either `ON` or `OFF` or `DEFAULT`.

1) If set to `ON`, informs the compiler that the program will access or modify floating-point environment, which means that optimizations that could subvert flag tests and mode changes (e.g., global common subexpression elimination, code motion, and constant folding) are prohibited. The default value is implementation-defined, usually `OFF`.
2) Allows contracting of floating-point expressions, that is optimizations that omit rounding errors and floating-point exceptions that would be observed if the expression was evaluated exactly as written. The default value is implementation-defined, usually `ON`.
3) Informs the compiler that multiplication, division, and absolute value of complex numbers may use simplified mathematical formulas, despite the possibility of intermediate overflow. The range of the values passed to those function is expected to be limited. The default value is `OFF`

The behavior of the program is undefined if any of the three pragmas above appear in any context other than outside all external declarations or preceding all explicit declarations and statements inside a compound statement.

### [edit] External links

- C++ pragmas in Visual Studio 2010
- Pragmas accepted by GCC 4.6.2
- General Purpose Pragmas in IBM AIX XL C/C++ V7.0
- Appendix B. Pragmas in Sun Studio 11 C++ User's Guide
- Intel C++ compiler pragmas

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/preprocessor/impl&oldid=69255"