ZT_LOCATION_AT(3)
π« NAME π«
zt_location_at β the little function that packs a file name and a line number into one single zt_location value π
β¨ SYNOPSIS β¨
#include <zt.h>
zt_location
zt_location_at(const char* fname, int lineno);
π¦ DESCRIPTION π¦
okay so bestie, zt_location_at takes both of its args and smooshes them together into one zt_location. that's it, that's the whole job π
why does it exist tho? because it lets you pack up a zt_claim value without any temporary variables β no extra locals cluttering up your function, no cap. it's highkey here to support C compilers that don't do structure literals. so if your compiler is being a little diva about { ... } initializers, this is your girl π«Ά
and for conveniently grabbing the current file and line number? use the macro ZT_CURRENT_LOCATION() β¨
π₯ IMPLEMENTATION NOTES π₯
zt_location_atis only provided as astatic inlinefunction. that's the whole vibe, no external symbol, no nothing.- the
fnameargument is retained by the value β so it's not copied or anything, the location just holds onto it. and it's typically a constant string literal that the preprocessor handed you. so like, don't go passing it a buffer you're about to free, iykyk π
π RETURN VALUES π
a zt_location containing the given file name and line number. literally what you gave it, but packed. slay β¨
π SEE ALSO π
π HISTORY π
zt_location_at first appeared in libzt 0.1. an icon from the very beginning, periodt.
π AUTHORS π
Zygmunt Krynicki <me@zygoon.pl> β thank you for this absolute gift π
and that's the whole page bestie!! this one lives in libzt 0.3.1, and it was written down on January 12, 2020. it's a LOCAL manual page, section 3, which is where all the library functions hang out π§ go forth and pack your locations π
π¦ 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