std::feholdexcept(3)
π NAME π
std::feholdexcept - std::feholdexcept. Yes bestie, the NAME section is literally the function name twice, and honestly? The confidence is iconic. This page is from the C++ Standard Libary manual (that spelling is in the page header and we are keeping it, no notes π
).
πΈ Synopsis πΈ
Defined in header <cfenv>.
int feholdexcept( std::fenv_t* envp ) (since C++11)
Marked (since C++11), so this is very much a C++11-and-later baddie.
Hereβs the whole glow-up sequence, step by step:
- First it saves the current floating-point environment into the object pointed to by
envpβ similar tostd::fegetenv. - Then it clears all floating-point status flags.
- Then it installs the non-stop mode: future floating-point exceptions will not interrupt execution (will not trap), until the floating-point environment is restored by
std::feupdateenvorstd::fesetenv.
Think of it as a little subroutine cloak: this function may be used at the beginning of a subroutine that must hide the floating-point exceptions it may raise from the caller. So the caller doesnβt get jump-scared by floating-point drama π.
And if only some exceptions must be suppressed while others must be reported, the non-stop mode is usually ended with a call to std::feupdateenv after clearing the unwanted exceptions. Periodt.
π Parameters π
envpβ pointer to the object of typestd::fenv_twhere the floating-point environment will be stored. Thatβs the little storage spot, bestie π«Ά.
β¨ Return value β¨
0 on success, non-zero otherwise. Thatβs it. Thatβs the vibe check.
π¦ See also π¦
feupdateenvβ restores the floating-point environment and raises the previously raised exceptions (function)(since C++11).fegetenvβ saves or restores the current floating-point environment (function).fesetenvβ function, with the(since C++11)tag hanging out with it.FE_DFL_ENVβ default floating-point environment (macro constant)(since C++11).- C documentation for
feholdexcept.
Source/version/date check, bestie: this page is from http://cppreference.com, dated 2024.06.10, and itβs std::feholdexcept(3) β mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms