ZT_NULL(3)

πŸ’… ZT_NULL(3) β€” the "bestie, is this pointer literally nothing" page πŸŽ€

okay so welcome to the ZT_NULL(3) manual page, local section, and yes we're about to talk about the most iconic little guy in libzt: the one that checks whether a pointer is NULL. no cap, it's giving "is this thing even here" energy and I'm obsessed. ✨


🌸 NAME 🌸

ZT_NULL, zt_null β€” construct a claim that a pointer is NULL. that's the whole job. she clocks in, she says "that pointer is nothing", she clocks out. πŸ‘‘


✨ SYNOPSIS ✨

#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);

like yes, that's the whole thing, and every character matters so don't you dare retype it from memory bestie 😭


πŸ’– DESCRIPTION πŸ’–

so zt_null() constructs a claim that a given pointer is NULL. that's it, that's the assignment. 🫢

but listen β€” you should be using it through the macro ZT_NULL(), not calling the function by hand like a menace. the macro is the main character here because it handles the boring-but-critical stuff for you: it passes the source code location and it packs the argument. that's why the macro is the vibe and the raw function is just backstage. 🌈

ZT_NULL() is highkey useful when you couple it with zt_assert(), because it lets you make sure that something the rest of the test relies on did not happen. for example: that no error had occurred. like, you're not just hoping bestie, you're claiming it, out loud, in the source code, with receipts. πŸ’…


πŸ”₯ IMPLEMENTATION NOTES πŸ”₯

ZT_NULL() evaluates value only once.

no double-evaluation jumpscare, no side effects firing twice. we love a considerate macro. 🧚


πŸŽ€ RETURN VALUES πŸŽ€

both the macro and the function return a zt_claim structure with the appropriate attributes set. so whatever you call, you get a claim back. πŸ’–

and that returned claim is usually passed to zt_check() or to zt_assert(), because a claim with nowhere to go is just a girl standing in a room. πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹

(yes she's listed in her own SEE ALSO. self-love. periodt. πŸ’…)


🌟 HISTORY 🌟

the ZT_NULL() macro and the zt_null() function first appeared in libzt 0.1. an OG. a founding member. we stan a legacy. πŸŽ€


πŸ‘‘ AUTHORS πŸ‘‘

Zygmunt Krynicki <me@zygoon.pl> β€” the mastermind, the icon, the one who wrote this into existence. 🫢


ok that's the whole page bestie, every flag, every macro, every claim, nothing skipped, we ate and left no crumbs πŸ’€βœ¨

signing off from libzt 0.3.1, dated January 12, 2020 β€” go forth and assert that your pointers are NULL, fr fr πŸ¦‹πŸ’–