std1.0.0-beta-7 SafeC docs

Module panic

#include <std/panic.h> source

Optional Panic System Opt-in; does nothing unless panic_set_handler is called. In freestanding mode defaults to infinite loop; hosted mode calls abort().

Type aliases

PanicHandler

Functions

panic_set_handlerInstall a custom panic handler. Pass NULL to reset to default.
panic_atTrigger a panic with message, file, line. Never returns.
expect_refChecked narrowing of a nullable reference: returns 'r' as '&T', or panics with 'msg' if it is null. The explicit form of "this can't be null here" — a cast '(&T)r' is rejected because it would skip the check. For recoverable absence, 'match (r) { case null: ... case some(x): ... }'.

Macros

PANIC
PANIC_ASSERT