ic-macros  0.1.5
ic_assert.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IC_ASSERT(expr, msg...)    (expr) == 0 ? _ic_assert_fail(__FILE__, __LINE__, #expr, ""##msg) : ({})
 Runtime assertion. More...
 
#define IC_ASSERT_CONDITION(expr, condition, msg...)
 Runtime assertion that returns the evaluated expression. More...
 

Macro Definition Documentation

◆ IC_ASSERT

#define IC_ASSERT (   expr,
  msg... 
)     (expr) == 0 ? _ic_assert_fail(__FILE__, __LINE__, #expr, ""##msg) : ({})

Runtime assertion.

Parameters
exprAn expression; if it evaluates to 0 then _ic_assert_fail() is called.
msg...An optional debug message describing the assert.

Definition at line 18 of file ic_assert.h.

◆ IC_ASSERT_CONDITION

#define IC_ASSERT_CONDITION (   expr,
  condition,
  msg... 
)
Value:
({ \
__auto_type const _IC_ASSERT_expr_ = (expr); \
(_IC_ASSERT_expr_ condition) ? _ic_assert_fail(__FILE__, __LINE__, #expr, ""##msg) \
: _IC_ASSERT_expr_; \
})

Runtime assertion that returns the evaluated expression.

Parameters
exprAn expression.
conditionThe condition that the result of the expression is held to, e.g. >= 0
msg...An optional debug message describing the assert.
Returns
The evaluated expression, expr.

Definition at line 28 of file ic_assert.h.