Metalang99 1.13.3
Full-blown preprocessor metaprogramming
|
Static assertions. More...
Go to the source code of this file.
Macros | |
#define | ML99_assert(expr) ML99_call(ML99_assert, expr) |
The same as ML99_ASSERT but results in a Metalang99 term. | |
#define | ML99_assertEq(lhs, rhs) ML99_call(ML99_assertEq, lhs, rhs) |
Like ML99_assert but compares lhs with rhs for equality (== ). | |
#define | ML99_ASSERT(expr) ML99_ASSERT_EQ(expr, ML99_true()) |
Asserts ML99_EVAL(expr) at compile-time. | |
#define | ML99_ASSERT_EQ(lhs, rhs) ML99_ASSERT_UNEVAL((ML99_EVAL(lhs)) == (ML99_EVAL(rhs))) |
Asserts ML99_EVAL(lhs) == ML99_EVAL(rhs) at compile-time. | |
#define | ML99_ASSERT_UNEVAL(expr) ML99_PRIV_ASSERT_UNEVAL_INNER(expr) |
Asserts the C constant expression expr ; static_assert in pure C99. | |
#define | ML99_ASSERT_EMPTY(expr) ML99_ASSERT_EMPTY_UNEVAL(ML99_EVAL(expr)) |
Asserts that ML99_EVAL(expr) is emptiness. | |
#define | ML99_ASSERT_EMPTY_UNEVAL(expr) ML99_ASSERT_UNEVAL(ML99_PRIV_CAT(ML99_PRIV_ASSERT_EMPTY_, expr)) |
Asserts that expr is emptiness. | |
Static assertions.
For the sake of convenience, this header automatically includes metalang99/bool.h
.
_Static_assert
and, therefore, can be used on the same line twice. #define ML99_assert | ( | expr | ) | ML99_call(ML99_assert, expr) |
The same as ML99_ASSERT but results in a Metalang99 term.
It can be used inside other Metalang99-compliant macros, unlike ML99_ASSERT, which uses ML99_EVAL internally.
#define ML99_ASSERT | ( | expr | ) | ML99_ASSERT_EQ(expr, ML99_true()) |
Asserts ML99_EVAL(expr)
at compile-time.
#define ML99_ASSERT_EMPTY | ( | expr | ) | ML99_ASSERT_EMPTY_UNEVAL(ML99_EVAL(expr)) |
Asserts that ML99_EVAL(expr)
is emptiness.
#define ML99_ASSERT_EMPTY_UNEVAL | ( | expr | ) | ML99_ASSERT_UNEVAL(ML99_PRIV_CAT(ML99_PRIV_ASSERT_EMPTY_, expr)) |
Asserts that expr
is emptiness.
#define ML99_ASSERT_EQ | ( | lhs, | |
rhs | |||
) | ML99_ASSERT_UNEVAL((ML99_EVAL(lhs)) == (ML99_EVAL(rhs))) |
Asserts ML99_EVAL(lhs) == ML99_EVAL(rhs)
at compile-time.
#define ML99_ASSERT_UNEVAL | ( | expr | ) | ML99_PRIV_ASSERT_UNEVAL_INNER(expr) |
Asserts the C constant expression expr
; static_assert in pure C99.