|
Sen API
Sen Libraries
|
The following macros implement a replacement of assert that is connected to the overall fault handling mechanism present in the runtime. It avoids conditional compilation (debug vs no debug). These macros are very rough and simple approximation to the idea of contracts, as they allow expressing pre-conditions, post-conditions and invariants and perform some checks during execution. Take into account that a failed 'expect', 'assert' or 'ensure' indicate a bug in the software and means that the process is in a state that was not reasoned about when writing the code. For most applications this implies that no decision can be made at that point and therefore the usual approach is to terminate or restart. More...
Go to the source code of this file.
Namespaces | |
| namespace | sen |
Macros | |
| #define | SEN_EXPECT(expr) |
| Checks a pre-condition of a procedure (function parameter for example). NOLINTNEXTLINE. | |
| #define | SEN_ASSERT(expr) |
| Checks an intermediate result produced by a procedure (not an input or output). NOLINTNEXTLINE. | |
| #define | SEN_ENSURE(expr) |
| Checks a post-condition of a procedure (function return value for example). NOLINTNEXTLINE. | |
Functions | |
| void | sen::registerTerminateHandler () |
| Installs a custom termination handler. | |
| void | sen::throwRuntimeError (const std::string &err) |
| Throws std::exception that attempts to collect the stack trace. We also wrap it to avoid including stdexcept. | |
| void | sen::trace () |
| Prints the current stack trace to stderr. | |
| void | sen::trace (std::string preMessage) |
| Prints the current stack trace to stderr. | |
The following macros implement a replacement of assert that is connected to the overall fault handling mechanism present in the runtime. It avoids conditional compilation (debug vs no debug). These macros are very rough and simple approximation to the idea of contracts, as they allow expressing pre-conditions, post-conditions and invariants and perform some checks during execution. Take into account that a failed 'expect', 'assert' or 'ensure' indicate a bug in the software and means that the process is in a state that was not reasoned about when writing the code. For most applications this implies that no decision can be made at that point and therefore the usual approach is to terminate or restart.