on (1)
off (2)
#pragma STDC FENV_ACCESS off
Access to Floating-point environment
If set to on, the program informs the compiler that it might access the floating-point environment to test its status flags (exceptions) or run under control modes other than the one by default.

If set to off, the compiler may perform certain optimizations that can subvert these tests and mode changes, and thus accessing the floating-point environment in the cases described above, causes undefined behavior.

Whether the state of this pragma by default is on or off depends on the compiler settings and library implementation.

The pragma declaration shall occur either:
  • outside any external declaration: Its effects last until another FENV_ACCESS pragma is encountered, or until the end of the translation unit.
  • inside a compound statement: In this case it shall precede all explicit declarations and statements. Its effects last until another FENV_ACCESS pragma is encountered (such as in a nested compound statement), or until the end of the compound statement. After the compound statement, the state of the pragma is restored to the condition it had before entering it.
If this pragma appears in other contexts, the behavior is undefined.

When the state is changed by this pragma directive, the floating-point control modes (such as rounding direction) have their default settings, but the state of the floating point status flags is unspecified.

See also