Loading...
Searching...
No Matches
Assert

Assertion helpers. More...

## Macros

#define | ec_assert_print(expr, args...)
| Abort if the condition is false.
#define | EC_CHECK_ARG(cond, ret, err)
| Check a condition or return.

## Detailed Description

Assertion helpers.

Helpers to check at runtime if a condition is true, or otherwise either abort (exit program) or return an error.

## Macro Definition Documentation

## ec_assert_print

#define ec_assert_print | ( |  | expr,
|  |  | args... )

Value:
__ec_assert_print(expr, #expr, args)

Abort if the condition is false.

If expression is false, this macro will print an error message to standard error and terminates the program by calling abort(3).

Parameters

  expr | The expression to be checked.
  args | The format string, optionally followed by other arguments.

Definition at line 34 of file assert.h.

## EC_CHECK_ARG

#define EC_CHECK_ARG | ( |  | cond,
|  |  | ret,
|  |  | err )

Value:
do { \
if (!(cond)) { \
errno = err; \
return ret; \
} \
} while (0)

Check a condition or return.

If the condition is true, do nothing. If it is false, set errno and return the specified value.

Parameters

  cond | The condition to test.
  ret | The value to return.
  err | The errno to set.

Definition at line 58 of file assert.h.