|
RKH
|
Specifies the assertion macros. More...
Files | |
| file | rkhassert.h |
| Specifies the assertion macros. | |
Macros | |
| #define | RKH_REQUIRE(exp) RKH_ASSERT(exp) |
| This macro checks the precondition. | |
| #define | RKH_ENSURE(exp) RKH_ASSERT(exp) |
| This macro checks the postcondition. | |
| #define | RKH_INVARIANT(exp) RKH_ASSERT(exp) |
| This macro is used to check a loop invariant. | |
Specifies the assertion macros.
The assertions (RKH_ASSERT() macro) are used to check expressions that ought to be true as long as the program is running correctly. It is a convenient way to insert sanity checks.
A number of philosophies can be employed when deciding where to use an RKH_ASSERT() macro. Broadly speaking, the assertions only serve the purposes of catching bugs and helping documentation. Helping to document the code means that the statements inside the assertion tell the reader something he might not already know.
| #define RKH_REQUIRE | ( | exp | ) | RKH_ASSERT(exp) |
This macro checks the precondition.
This macro is equivalent to RKH_ASSERT() macro, except the name provides a better documentation of the intention of this assertion.
Definition at line 180 of file rkhassert.h.
| #define RKH_ENSURE | ( | exp | ) | RKH_ASSERT(exp) |
This macro checks the postcondition.
This macro is equivalent to RKH_ASSERT() macro, except the name provides a better documentation of the intention of this assertion.
Definition at line 191 of file rkhassert.h.
| #define RKH_INVARIANT | ( | exp | ) | RKH_ASSERT(exp) |
This macro is used to check a loop invariant.
This macro is equivalent to RKH_ASSERT() macro, except the name provides a better documentation of the intention of this assertion.
Definition at line 202 of file rkhassert.h.