exceptions4c 4.0
Exceptions for C
|
Implementation of the exception handling library for C. More...
#include <stdio.h>
#include <errno.h>
#include <stdarg.h>
#include <stdnoreturn.h>
#include <exceptions4c.h>
Functions | |
void | e4c_set_context_supplier (struct e4c_context *(*supplier)(void)) |
Sets the exception context supplier. | |
struct e4c_context * | e4c_get_context (void) |
Supplies the current exception context. | |
const struct e4c_exception * | e4c_get_exception (void) |
Retrieves the last exception that was thrown. | |
bool | e4c_is_uncaught (void) |
Determines whether the thrown exception was not caught. | |
Implementation of the exception handling library for C.
void e4c_set_context_supplier | ( | struct e4c_context *(* | supplier )(void) | ) |
Sets the exception context supplier.
The library relies on this context to handle the current status of exceptions. If no supplier is provided, a default one will be used.
Example:
supplier | The function that supplies the current exception context. |
struct e4c_context * e4c_get_context | ( | void | ) |
Supplies the current exception context.
Example:
const struct e4c_exception * e4c_get_exception | ( | void | ) |
Retrieves the last exception that was thrown.
Example:
bool e4c_is_uncaught | ( | void | ) |
Determines whether the thrown exception was not caught.
An exception is considered "uncaught" if no matching CATCH or CATCH_ALL block has been executed for it. In other words, this function returns true
if the exception has bypassed all specific exception-handling logic and is propagating further. And it returns false
if no exception was thrown in the TRY block, or if an exception was successfully caught.
Example:
true
if the current exception (if any) has not yet been handled by any CATCH or CATCH_ALL block; false
otherwise.