---
name: "ZT_NOT_NULL"
section: "3"
platform: "linux"
package: "libzt-doc"
version: "0.3.1-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ZT_NOT_NULL"
---

# ZT\_NOT\_NULL(3)

construct a claim that a pointer is not NULL

## 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_check/3.md), [zt\_claim(3)](/zt_claim/3.md), [ZT\_CMP\_BOOL(3)](/ZT_CMP_BOOL/3.md), [ZT\_CMP\_RUNE(3)](/ZT_CMP_RUNE/3.md), ZT\_CMP\_CSTR(3), [ZT\_CMP\_INT(3)](/ZT_CMP_INT/3.md), [ZT\_CMP\_PTR(3)](/ZT_CMP_PTR/3.md), [ZT\_CMP\_UINT(3)](/ZT_CMP_UINT/3.md), [ZT\_FALSE(3)](/ZT_FALSE/3.md), [ZT\_NOT\_NULL(3)](/ZT_NOT_NULL/3.md), [ZT\_NOT\_NULL(3)](/ZT_NOT_NULL/3.md) [zt\_value(3)](/zt_value/3.md),

## HISTORY

The **ZT\_NOT\_NULL**() macro and the **zt\_not\_null**() function first appeared in libzt 0.1

## AUTHORS

Zygmunt Krynicki ⟨*me@zygoon.pl*⟩
