ZT_NULL(3)

ZT_NULL3

Construct a claim that a pointer is null

Usage

#include <zt.h>

#define ZT_NULL(value) \
  zt_null( \
    ZT_CURRENT_LOCATION(), \
    zt_pack_pointer((value), #value))

zt_claim

zt_null(zt_location location, zt_value value);

Overview

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

ZT_NULL() can be useful, when coupled with zt_assert(), to ensure that something that the reminder of the test relies on did not happen, for example that no error had occurred.

Implementation notes

ZT_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().

Releases

Unchanged in 3 releases since Debian 11 (Bullseye).

  1. 11–13

History

The ZT_NULL() macro and the zt_null() function first appeared in libzt 0.1

Authors

Zygmunt Krynicki ⟨[email protected]⟩

From libzt-doc 0.3.1-4 in Debian 13 (Trixie). Parsed by carta from the page's mdoc source.