ZT_CMP_INT(3)
π ZT_CMP_INT π
okay bestie, so this one's from the LOCAL manual (section 3, the library-calls girlies) and it's literally about telling libzt that two integers have a relationship. yes we're doing math gossip now. π
β¨ NAME β¨
ZT_CMP_INT, zt_cmp_int β construct a claim of a relation between two integers
πΈ SYNOPSIS πΈ
#include <zt.h>
#define ZT_CMP_INT(left, rel, right) \
zt_cmp_int( \
ZT_CURRENT_LOCATION(), \
zt_pack_integer((left), (#left)), \
zt_pack_string((#rel), (#rel)), \
zt_pack_integer((right), (#right)))
zt_claim
zt_cmp_int(zt_location location, zt_value left, zt_value rel,
zt_value right);
π¦ DESCRIPTION π¦
so zt_cmp_int() constructs a claim of a relation between two integers. that's it, that's the whole vibe. π
but like, do NOT call it directly, okay? you're supposed to go through the macro ZT_CMP_INT(), because the macro is the one doing the cute little extra work: it passes the source code location and it packs the arguments for you. she's the main character, the function is just backstage. β¨
the relation has to be one of these, and nothing else:
==!=<<=>>=
like, six options, pick one, no freestyling. π
π§ IMPLEMENTATION NOTES π§
ZT_CMP_INT() evaluates left and right exactly once. not twice. once. so no double-side-effect jump scares, we love a hygienic macro fr fr. π«Ά
β RETURN VALUES β
both the macro and the function hand you back a claim structure with the right attributes set. the way that... it just returns the claim. π
and then you usually pass that claim straight into zt_check() or into zt_assert(). that's the whole pipeline bestie, claim β check. π
π SEE ALSO π
ZT_CMP_BOOL(3)ZT_CMP_RUNE(3)ZT_CMP_CSTR(3)ZT_CMP_PTR(3)ZT_CMP_UINT(3)ZT_FALSE(3)ZT_NOT_NULL(3)ZT_NULL(3)ZT_TRUE(3)zt_check(3)
the whole comparison crew is here, they're all iconic, go say hi. π
π HISTORY π
the ZT_CMP_INT() macro and the zt_cmp_int() function first appeared in libzt 0.1. so like, day-one legends. π
and since libzt 0.3, zt_cmp_int() internally promotes the left and right arguments from ZT_INTEGER to ZT_INTMAX. glow-up era, honestly. β¨
π AUTHORS π
Zygmunt Krynicki <me@zygoon.pl>
and that's the page bestie!! written for libzt 0.3.1, dated January 12, 2020, and yeah it's the ZT_CMP_INT(3) one. go compare some integers, you absolute icon. π
πβ¨
π¦ where this page comes from
- debian bookworm: libzt-doc 0.3.1-4 Β· LGPL-3.0-only
- debian trixie: libzt-doc 0.3.1-4 Β· LGPL-3.0-only
- ubuntu jammy: libzt-doc 0.3.1-4 Β· LGPL-3.0-only
- ubuntu noble: libzt-doc 0.3.1-4build1 Β· LGPL-3.0-only
- ubuntu questing: libzt-doc 0.3.1-4build1
- ubuntu resolute: libzt-doc 0.3.1-4build2 Β· LGPL-3.0-only
- ubuntu stonking: libzt-doc 0.3.1-4build2 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms