ZT_NOT_NULL(3)

#define ZT_NOT_NULL(value) zt_not_null( ZT_CURRENT_LOCATION(), zt_pack_pointer((value), #value)) constructs a c

Section 3 libzt-doc bookworm source

Description

UNTITLED() LOCAL UNTITLED()

NAME

ZT_NOT_NULL, zt_not_null — construct a claim that a pointer is not NULL

SYNOPSIS

#include <zt.h>

#define ZT_NOT_NULL(value) \
zt_not_null( \
ZT_CURRENT_LOCATION(), \
zt_pack_pointer((value), #value))

zt_claim

zt_not_null(zt_location location, zt_value value);

DESCRIPTION

zt_not_null() constructs a claim that a given pointer is not NULL. It should be used through the macro ZT_NOT_NULL(), which passes source code location and packs argument.

ZT_NOT_NULL() can be useful, when coupled with zt_assert(), to ensure that an object was correctly produced, allocated or returned and that the reminder of the test can inspect its properties using zt_check().

IMPLEMENTATION NOTES

ZT_NOT_NULL() evaluates value only once.

RETURN VALUES

Both the macro and the function return a zt_claim structure with the appropriate attributes set. The returned claim is usually passed to zt_check() or to zt_assert().

SEE ALSO

zt_assert(3), zt_check(3), zt_claim(3), ZT_CMP_BOOL(3), ZT_CMP_RUNE(3), ZT_CMP_CSTR(3), ZT_CMP_INT(3), ZT_CMP_PTR(3), ZT_CMP_UINT(3), ZT_FALSE(3), ZT_NOT_NULL(3), ZT_NOT_NULL(3) zt_value(3),

HISTORY

The ZT_NOT_NULL() macro and the zt_not_null() function first appeared in libzt 0.1

AUTHORS

Zygmunt Krynicki <me@zygoon.pl> libzt 0.3.1 January 12, 2020 ZT_NOT_NULL(3)