ZT_PACK_UNSIGNED(3)

πŸ’– zt_pack_unsigned β€” the girlies' guide to packing unsigned ints πŸ’–

okay so bestie, welcome to zt_pack_unsigned(3), a page from the LOCAL manual. sit down, get a snack, we're gonna talk about shoving an unsigned integer into a variant. it's giving very demure, very mindful, very typed. πŸŽ€


✨ NAME ✨

zt_pack_unsigned β€” pack an unsigned integer into a variant 🫢


✨ SYNOPSIS ✨

#include <zt.h>

zt_value
zt_pack_unsigned(uintmax_t value, const char *source);

like. look at her. two args. immaculate. πŸ’…


✨ DESCRIPTION ✨

so what does zt_pack_unsigned actually do? bestie it packs an unsigned integer into a variant-like zt_value β€” and not just the number, okurrr, it also packs the string that describes the expression that was evaluated to get that number. both of them. together. in one value. iconic behavior honestly. πŸ‘‘

and the source argument? the value retains it. keeps it. holds onto it. and it's typically a constant string literal that the preprocessor produced, iykyk. 🧚


✨ IMPLEMENTATION NOTES ✨

okay important lore: zt_pack_unsigned is only provided as a static inline function. that's it. that's the whole note. no cap. πŸ’€


✨ RETURN VALUES ✨

she returns the packed value. periodt. πŸŽ€


✨ SEE ALSO ✨

the whole friend group, fr fr β€” and yes, we're listing every single one exactly as the page does, duplicates and all, because that's what it says:

not me noticing zt_pack_unsigned(3) showed up three times 😭 she said "know your worth, list yourself thrice." we love a main character. πŸ’…


✨ HISTORY ✨

story time, bestie. πŸ“–

zt_pack_unsigned first appeared in libzt 0.1. baby's first debut. 🌸

then in libzt 0.3 the type of the first argument changed to uintmax_t, to accommodate for wider values. glow up fr. and the resulting value structure encodes the new corresponding kind, ZT_UINTMAX. ⭐

πŸ’– heads up though: zt_value objects created by programs compiled with earlier versions of libzt are still valid and are internally promoted to the wider type. so nothing breaks, nobody's getting left behind, we all get promoted together. we love growth. πŸ¦‹

✨ AUTHORS ✨

Zygmunt Krynicki <me@zygoon.pl> β€” the icon, the legend, the one who wrote the docs. πŸ‘‘


and that's the whole page, bestie! this was libzt 0.3.1, dated January 12, 2020, and it's a LOCAL manual page for zt_pack_unsigned(3). go pack something. slay. πŸ’œβœ¨