std::breakp...f_debugging(3)

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

okay so bestie, welcome to the C++ Standard Libary manual β€” the header shows it as std::breakp...f_debugging(3) because truncation ate the rest 😭, but today's main character is std::breakpoint_if_debugging. let's get into it πŸ’…


πŸ’– NAME πŸ’–

std::breakpoint_if_debugging β€” literally std::breakpoint_if_debugging, that's the name, periodt.

✨ Synopsis ✨

Defined in header <debugging>:

void breakpoint_if_debugging() noexcept;  (since C++26)

It's a conditional breakpoint: it attempts to temporarily halt the execution of the program and transfer control to the debugger if it were able to determine that the debugger is present. Otherwise? No-op city. Acts as a no-op otherwise 🫢

Formally, the behavior of this function is completely implementation-defined.

Equivalent to this exact vibe:

if (std::is_debugger_present())
    std::breakpoint();

πŸŽ€ Notes πŸŽ€

Feature-test macro tea β˜•:

  • __cpp_lib_debugging = 202311L β€” Std: (C++26), Feature: Debugging support library
  • __cpp_lib_debugging = 202403L β€” Std: (C++26), Feature: Replaceable std::is_debugger_present

🌸 Example 🌸

This section is incomplete 😭 Reason: no example

πŸ¦‹ See also πŸ¦‹

  • is_debugger_present β€” checks whether a program is running under the control of a debugger. (C++26) (function)
  • breakpoint β€” pauses the running program when called. (C++26) (function)

πŸ—‚οΈ Category πŸ—‚οΈ

  • Todo no example

mwah πŸ’‹ source is http://cppreference.com, date 2024.06.10, and the footer version/slug is std::breakp...f_debugging(3) β€” that's the whole page, bestie, go debug something cute πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from