Module libc/assert
libc/assert
Stability: unstable — a raw C binding, not a Yo design. C's `assert` is a macro, so what is bound here are the libc-internal functions the macro expands to, and which of them exists is a C library detail: glibc has `__assert_fail`, Apple's libc has `__assert`, and `_Static_assert_fail` is not universal. Nothing in the tree imports this module — the supported assertion surface is `std/assert` (`assert` / `panic`, lowered to the `__yo_panic` builtin) — and it exists because user code may not write its own `c_include`. Freezing it would mean committing to one spelling per C library, which is what `std/assert` already does in Yo. — stable modules only change additively; this one may still change.
C11 <assert.h> — assertion debugging facility.
Provides runtime assertion checking for debugging.
Stability
unstable — a raw C binding, not a Yo design. C's assert is a macro, so
what is bound here are the libc-internal functions the macro expands to,
and which of them exists is a C library detail: glibc has
__assert_fail, Apple's libc has __assert, and _Static_assert_fail
is not universal. Nothing in the tree imports this module — the
supported assertion surface is std/assert (assert / panic, lowered
to the __yo_panic builtin) — and it exists because user code may not
write its own c_include. Freezing it would mean committing to one
spelling per C library, which is what std/assert already does in Yo.
Functions
__assert_fail
function
fn(assertion : *(char), file : *(char), line : uint, function : *(char)) -> unit
Parameters
| Name | Type | Notes |
|---|---|---|
assertion | *(char) | |
file | *(char) | |
line | uint | |
function | *(char) |
Returns: unit
__assert
function
fn(assertion : *(char), file : *(char), line : int) -> unit
Parameters
| Name | Type | Notes |
|---|---|---|
assertion | *(char) | |
file | *(char) | |
line | int |
Returns: unit
_Static_assert_fail
function
fn(message : *(char)) -> unit
Parameters
| Name | Type | Notes |
|---|---|---|
message | *(char) |
Returns: unit