|
htils 1
A small set of utilities for C programming.
|
#include <htils/basictypes.h>Go to the source code of this file.
Macros | |
| #define | _GNU_SOURCE |
| #define | htils_assert(expr) |
Assert that expr is true, terminating the program otherwise. | |
Functions | |
| _Noreturn void | __htils_assert_fail (const cstr *expr_str, const cstr *executable, const cstr *file, u32 line, const cstr *func) |
| Terminates the program with an error message. | |
Variables | |
| cstr * | program_invocation_short_name |
| The name of the program, exposed by the GNU standard. | |
| #define _GNU_SOURCE |
For using the GNU extension program_invocation_short_name
| #define htils_assert | ( | expr | ) |
Assert that expr is true, terminating the program otherwise.
On failure, calls __htils_assert_fail() with the expression text, the program name, and the file/line/function via __FILE__, __LINE__, and __func__.
| expr | The expression to assert. |
| _Noreturn void __htils_assert_fail | ( | const cstr * | expr_str, |
| const cstr * | executable, | ||
| const cstr * | file, | ||
| u32 | line, | ||
| const cstr * | func ) |
Terminates the program with an error message.
Prints the error message to stderr, and then terminates the program using exit().
| expr_str | The expression as string. |
| executable | The executable name. |
| file | The file name. |
| line | The line number. |
| func | The function name. |
|
extern |
The name of the program, exposed by the GNU standard.
This variable is exposed by the GNU standard, and is used to get the program name without relying on argv[0].