Namespaces
Variants
Views
Actions

Implementation defined behavior control

From cppreference.com
< cpp‎ | preprocessor
Revision as of 13:00, 2 November 2012 by P12bot (Talk | contribs)

 
 
C++ language
General topics
Flow control
Conditional execution statements
Iteration statements
Jump statements
Functions
function declaration
lambda function declaration
function template
inline specifier
exception specifications (deprecated)
noexcept specifier (C++11)
Exceptions
Namespaces
Types
decltype specifier (C++11)
Specifiers
cv specifiers
storage duration specifiers
constexpr specifier (C++11)
auto specifier (C++11)
alignas specifier (C++11)
Initialization
Literals
Expressions
alternative representations
Utilities
Types
typedef declaration
type alias declaration (C++11)
attributes (C++11)
Casts
implicit conversions
const_cast conversion
static_cast conversion
dynamic_cast conversion
reinterpret_cast conversion
C-style and functional cast
Memory allocation
Classes
Class-specific function properties
Special member functions
Templates
class template
function template
template specialization
parameter packs (C++11)
Miscellaneous
Inline assembly
 
 

Implementation defined behavior is controlled by #pragma directive.

Contents

Syntax

#pragma Template:sparam

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.

Standard pragmas

The following three pragmas are defined by the language standard:

#pragma STDC FENV_ACCESS Template:sparam (1)
#pragma STDC FP_CONTRACT Template:sparam (2)
#pragma STDC CX_LIMITED_RANGE Template:sparam (3)

where Template:sparam 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

External links