ZT_TRUE(3)

πŸ’– ZT_TRUE πŸ’–

okay bestie, so we're in the libzt corner of the manual β€” section 3, the C library function pages β€” and today's main character is ZT_TRUE and its function bestie zt_true. the whole vibe? you're constructing a claim that some value is true. that's it. that's the job. ✨


🌸 NAME 🌸

ZT_TRUE, zt_true β€” construct a claim that a value is true


πŸŽ€ SYNOPSIS πŸŽ€

#include <zt.h>

#define ZT_TRUE(value) \
  zt_true( \
    ZT_CURRENT_LOCATION(), \
    zt_pack_boolean((value), #value)) \

zt_claim
zt_true(zt_location location, zt_value value);

πŸ¦‹ DESCRIPTION πŸ¦‹

so zt_true() does exactly one thing and it does it slay: it constructs a claim that a given value is true. πŸ‘‘

but listen β€” you're not supposed to call the function directly, bestie. you use it through the macro ZT_TRUE(), which is the one that passes the source code location and packs the argument for you. the macro is the whole point. the function is just the machinery underneath. iykyk. πŸ’…

zt_true() can also be used to check custom properties, by calling arbitrary verification logic. the trade-off tho? when that fails, the error message can't precisely explain what the problem actually was. like, it'll tell you something went wrong, but not what went wrong in a nice specific way. it's giving mystery. πŸ•΅οΈβ™€οΈ


πŸ”₯ IMPLEMENTATION NOTES πŸ”₯

ZT_TRUE() evaluates value only once.

no double-evaluation shenanigans, no side effects firing twice, we love to see it. 🫢


✨ RETURN VALUES ✨

both the macro and the function hand you back a zt_claim structure, with the appropriate attributes all set. 🎁

and what do you do with that claim? you usually pass it straight to zt_check() or to zt_assert(). those are the ones that actually make a fuss about it. periodt.


🌈 SEE ALSO 🌈


πŸ’œ HISTORY πŸ’œ

the ZT_TRUE() macro and the zt_true() function first appeared in libzt 0.1. iconic behaviour from day one, no cap. 🌟


πŸ“ AUTHORS πŸ“

Zygmunt Krynicki <me@zygoon.pl>


and that's the whole page, bestie!! this was libzt 0.3.1, dated January 12, 2020, for ZT_TRUE(3) in the LOCAL manual section. go forth and assert things. true ones. πŸ’–πŸ§šπŸ’