ZT_PACK_STRING(3)

✨ zt_pack_string β€” the manual page, but make it cute ✨

okay so bestie, welcome to the LOCAL manual, section 3 πŸŽ€ this one is all about zt_pack_string and it's lowkey iconic, let's get into it πŸ’…


🌸 NAME 🌸

zt_pack_string β€” pack an C string into a variant πŸ¦‹


⭐ SYNOPSIS ⭐

#include <zt.h>

zt_value
zt_pack_string(const char *value, const char *source);

πŸ’– DESCRIPTION πŸ’–

okay so zt_pack_string does the thing where it takes a C string and packs it into a variant-like zt_value β€” and not just the string, bestie, it also packs in the string that describes the expression that got evaluated to produce it. two for one, we love to see it 😭✨

the source argument? that one gets retained by the value, like it's holding onto it, and it's typically a constant string literal that the preprocessor made. so it's giving "I was born in a macro" energy fr fr.


🧚 IMPLEMENTATION NOTES 🧚

so here's the tea πŸ‘‘ β€” zt_pack_string is only provided as a static inline function. that's it, that's the whole vibe.

and also, very important, no cap: the memory that the string references is not copied. it's just assumed that the memory reference stays valid during the execution of the verification of an assertion that relies on the zt_value. so like… if that memory dips out on you mid-verification, that's on you bestie, the function did not sign up for that πŸ’€


🌈 RETURN VALUES 🌈

the packed value. that's the whole answer. slay πŸ’…


🫢 SEE ALSO 🫢

(yes bestie, zt_pack_string(3) really is in there four times β€” that's exactly how the original wrote it, so we're keeping it, periodt πŸŽ€)


πŸ“œ HISTORY πŸ“œ

zt_pack_string first appeared in libzt 0.1 β€” a true original, the main character from day one ⭐


πŸ’œ AUTHORS πŸ’œ

Zygmunt Krynicki <me@zygoon.pl> πŸ¦‹


and that's the whole page bestie!! this little beauty is from libzt 0.3.1, dated January 12, 2020 🌸 take care of her, she's doing her best πŸ₯ΊπŸ’– bye pookie, go pack some strings ✨