|
HikoGUI
A low latency retained GUI
|
Utilities to assert and bound check. More...
#include "architecture.hpp"#include "debugger.hpp"#include "utility.hpp"#include "type_traits.hpp"#include "exception.hpp"#include <exception>#include <ranges>Go to the source code of this file.
Namespaces | |
| namespace | v1 |
| DOXYGEN BUG. | |
Concepts | |
| concept | v1::bound_check_range_helper |
Macros | |
| #define | hi_assert(expression) |
| Assert if expression is true. | |
| #define | hi_assert_or_return(x, y) |
| Assert if an expression is true. | |
| #define | hi_assert_bounds(x, ...) |
| #define | hi_assert_not_null(x) |
| Assert if an expression is not nullptr. | |
| #define | hi_axiom(expression) hi_assert(expression) |
| Specify an axiom; an expression that is true. | |
| #define | hi_axiom_not_null(expression) hi_assert_not_null(expression) |
| Assert if an expression is not nullptr. | |
| #define | hi_no_default() [[unlikely]] hi_debug_abort() |
| This part of the code should not be reachable, unless a programming bug. | |
| #define | hi_static_no_default() |
| This part of the code should not be reachable, unless a programming bug. | |
| #define | hi_not_implemented() [[unlikely]] hi_debug_abort(); |
| This part of the code has not been implemented yet. | |
| #define | hi_static_not_implemented() hi_static_no_default() |
| This part of the code has not been implemented yet. | |
Functions | |
| constexpr bool | v1::bound_check (std::unsigned_integral auto index, std::unsigned_integral auto upper) noexcept |
| Check if an unsigned index is less than the bound. | |
| constexpr bool | v1::bound_check (std::integral auto index, std::integral auto lower, std::integral auto upper) noexcept |
| Check if an index is between the lower (inclusive) and upper (exclusive). | |
| constexpr bool | v1::bound_check (std::integral auto index, bound_check_range_helper auto &&range) noexcept |
| Check if an index is within a range. | |
Utilities to assert and bound check.
| #define hi_assert | ( | expression | ) |
Assert if expression is true.
Independent of built type this macro will always check and abort on fail.
| expression | The expression to test. |
| #define hi_assert_bounds | ( | x, | |
| ... ) |
| #define hi_assert_not_null | ( | x | ) |
Assert if an expression is not nullptr.
If the expression is not a nullptr then return from the function.
| x | The expression to test |
| #define hi_assert_or_return | ( | x, | |
| y ) |
Assert if an expression is true.
If the expression is false then return from the function.
| x | The expression to test |
| y | The value to return from the current function. |
| #define hi_axiom | ( | expression | ) | hi_assert(expression) |
Specify an axiom; an expression that is true.
An axiom is checked in debug mode, and is used as an optimization in release mode.
| expression | The expression that is true. |
| #define hi_axiom_not_null | ( | expression | ) | hi_assert_not_null(expression) |
Assert if an expression is not nullptr.
If the expression is not a nullptr then return from the function.
| x | The expression to test |
| #define hi_no_default | ( | ) | [[unlikely]] hi_debug_abort() |
This part of the code should not be reachable, unless a programming bug.
This function should be used in unreachable else statements or switch-default labels,
| #define hi_not_implemented | ( | ) | [[unlikely]] hi_debug_abort(); |
This part of the code has not been implemented yet.
This aborts the program.
| #define hi_static_no_default | ( | ) |
This part of the code should not be reachable, unless a programming bug.
This function should be used in unreachable constexpr else statements.
| #define hi_static_not_implemented | ( | ) | hi_static_no_default() |
This part of the code has not been implemented yet.
This function should be used in unreachable constexpr else statements.