std::fegete...etexceptflag(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ std::fegetexceptflag, std::fesetexceptflag ✨

Okay so bestie, welcome to the std::fegetexceptflag / std::fesetexceptflag glow-up πŸ’…. This page lives in the C++ Standard Library manual, and it's all about grabbing and setting those floating-point exception flags. No cap, it's giving "save file for your math errors" energy. πŸŽ€


🌸 SYNOPSIS 🌸

Defined in header <cfenv>.

int fegetexceptflag( std::fexcept_t* flagp, int excepts );       (1)

(since C++11)

int fesetexceptflag( const std::fexcept_t* flagp, int excepts ); (2)

(since C++11)

So here's the tea, one by one:

  1. Attempts to obtain the full contents of the floating-point exception flags that are listed in the bitmask argument excepts, which is a bitwise OR of the floating point exception macros. 🫢
  2. Attempts to copy the full contents of the floating-point exception flags that are listed in excepts from flagp into the floating-point environment. It does not raise any exceptions, bestie β€” it only modifies the flags. Periodt. ✨

Now, this is the part where I need you to lock in, because it's lowkey important: the full contents of a floating-point exception flag is not necessarily a boolean value indicating whether the exception is raised or cleared. For example, it may be a struct which includes the boolean status and the address of the code that triggered the exception. These functions obtain all such content and obtain/store it in flagp in implementation-defined format. So yeah, it's giving "more than just a yes/no" and you just gotta trust the implementation. πŸ™ˆ


🌈 PARAMETERS 🌈

  • flagp β€” pointer to an std::fexcept_t object where the flags will be stored or read from. πŸ¦‹
  • excepts β€” bitmask listing the exception flags to get/set. πŸ’œ

⭐ RETURN VALUE ⭐

0 on success, non-zero otherwise. That's it, that's the whole vibe check. πŸ’€


πŸ”₯ SEE ALSO πŸ”₯

C documentation for fegetexceptflag, fesetexceptflag β€” go check the C side if you want the og lore, iykyk. πŸ‘‘


Okay bestie, that's the whole page! You ate that. πŸ’…βœ¨ And just so we're keeping it 100, this masterpiece came from cppreference.com, dated 2024.06.10. Iconic behavior, fr fr. πŸŽ€πŸ«ΆπŸ’–

πŸ“¦ where this page comes from