C3E: Complex Compute Core Engine v1.0
An engine for handling complex computational tasks
Loading...
Searching...
No Matches
assert.h File Reference

Header file for custom assertion handling functions. More...

#include <stdbool.h>
Include dependency graph for assert.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void c3e_assert (bool condition)
 Evaluates an assertion and triggers a custom handler if the condition is false.
 
void c3e_assert_handler (void(*event)(const char *filename, int line))
 Sets a custom assertion handler.
 
void c3e_assert_remove_handle ()
 Removes the currently set custom assertion handler.
 
bool c3e_assert_has_handler ()
 Checks if a custom assertion handler is currently set.
 

Detailed Description

Author
Nathanne Isip

This header file provides functions for custom assertion handling in the C3E library. It allows setting up custom assertion handlers, removing them, and checking if a handler is currently set.

Function Documentation

◆ c3e_assert()

void c3e_assert ( bool  condition)

This function evaluates the given condition and triggers the custom assertion handler if the condition evaluates to false. If no custom handler is set, the default behavior is to print an assertion message and terminate the program.

Parameters
conditionThe condition to evaluate. If this condition evaluates to false, the assertion fails and the custom handler (if set) will be triggered.

◆ c3e_assert_handler()

void c3e_assert_handler ( void(*)(const char *filename, int line)  event)

This function sets a custom handler function that will be called when an assertion fails. The handler function should accept two parameters: a filename and a line number where the assertion failed.

Parameters
eventA pointer to the custom handler function. This function will be called when an assertion fails. The handler function should have the signature: void handler(const char* filename, int line).
See also
c3e_assert

◆ c3e_assert_has_handler()

bool c3e_assert_has_handler ( )

This function checks whether a custom assertion handler has been set using c3e_assert_handler().

Returns
true if a custom assertion handler is currently set, false otherwise.

◆ c3e_assert_remove_handle()

void c3e_assert_remove_handle ( )

This function removes the custom assertion handler that was previously set using c3e_assert_handler(). After calling this function, assertions will use the default behavior, which is to terminate the program.