ZT_PACK_INTEGER(3)
π zt_pack_integer β bestie's guide to packing ints π
okay so. this is a page from the LOCAL manual set, and it's all about zt_pack_integer(3). yes bestie, the one that packs an integer into a variant. let's get into it π«Ά
β¨ NAME β¨
zt_pack_integer β pack an integer into a variant π
πΈ SYNOPSIS πΈ
#include <zt.h>
zt_value
zt_pack_integer(intmax_t value, const char *source);
like. that's it. that's the whole vibe. two args and a zt_value coming right back at you π
π¦ DESCRIPTION π¦
okay so here's the tea. zt_pack_integer takes an integer β and also the string that describes the expression that got evaluated to produce it β and packs both of them into a variant-like zt_value. two for one, iconic behaviour, no notes π
the source argument is retained by the value, which is lowkey important. it's typically a constant string literal produced by the preprocessor. so like, the value remembers where it came from. main character energy fr fr β¨
π₯ IMPLEMENTATION NOTES π₯
zt_pack_integer is only provided as a static inline function. that's the whole note. it's not out here living in some object file, it's just vibing inline. iykyk π
π RETURN VALUES π
the packed value. that's the return. slay π
π SEE ALSO π
zt_pack_nothing(3)zt_pack_integer(3)zt_pack_rune(3)zt_pack_integer(3)zt_pack_unsigned(3)zt_pack_string(3)zt_pack_pointer(3)zt_value(3)
(yes zt_pack_integer(3) is in there twice. and a comma situation. we're keeping it exactly as written, bestie β no cap, i do not edit the source material π«Ά)
π HISTORY π
zt_pack_integer first appeared in libzt 0.1. baby's first debut π
then in libzt 0.3 the type of the first argument changed to intmax_t, to accommodate for wider values. glow-up era β¨ the resulting value structure encodes the new corresponding kind, ZT_INTMAX.
note that zt_value objects created by programs compiled with earlier versions of libzt are still valid and are internally promoted to the wider type. so your old stuff still works?? we love backwards compatibility in this house π
π AUTHORS π
Zygmunt Krynicki <me@zygoon.pl> β the legend themselves π
and that's the whole page!! this was libzt 0.3.1, dated January 12, 2020 β shoutout to the LOCAL manual section for having us, mwah π
πβ¨
π¦ 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