ZT_CMP_BOOL(3)

✨ ZT_CMP_BOOL(3) ✨

okay bestie, welcome to the ZT_CMP_BOOL page πŸ’– this is from section 3 of the manual (the LOCAL one, iykyk) and no, the original page literally had no title line so we're just vibing with the name, periodt.


🌸 NAME 🌸

ZT_CMP_BOOL, zt_cmp_bool β€” bestie we are literally constructing a claim of a relation between two booleans and it's giving very demure, very mindful πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <zt.h>

#define ZT_CMP_BOOL(left, rel, right) \
  zt_cmp_bool( \
    ZT_CURRENT_LOCATION(), \
    zt_pack_boolean((left), (#left)), \
    zt_pack_string((#rel), (#rel)), \
    zt_pack_boolean((right), (#right)))

zt_claim
zt_cmp_bool(zt_location location, zt_value left, zt_value rel,
    zt_value right);

like, there's a macro and a function, and the macro is the one you actually use, no cap πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

okay so zt_cmp_bool() constructs a claim of a relation between two booleans. that's the whole job. but listen β€” you should be using it through the macro ZT_CMP_BOOL(), which is the one that passes the source code location and packs the arguments for you. the raw function is lowkey the behind-the-scenes girlie 🎬

the relation must be either == or !=. those are literally the only two options. anything else? not it. πŸ™…β™€οΈ

and ngl, it may be more natural to use ZT_TRUE() or ZT_FALSE() instead. just saying. consider it. ✨


🫢 IMPLEMENTATION NOTES 🫢

ZT_CMP_BOOL() evaluates left and right exactly once. that's it, that's the note, and it's iconic because side effects won't get double-dipped πŸ“


🌈 RETURN VALUES 🌈

both the macro and the function return a claim structure with the right attributes set. so like, it's a whole struct situation πŸ’€ the returned claim is usually passed to zt_check() or to zt_assert(). that's the pipeline, bestie πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group fr fr πŸ«‚


πŸ¦‹ HISTORY πŸ¦‹

the ZT_CMP_BOOL() macro and the zt_cmp_bool() function first appeared in libzt 0.1 β€” so they're basically elders in the libzt universe and we respect them for it πŸ’–


🌟 AUTHORS 🌟

Zygmunt Krynicki <me@zygoon.pl> β€” the main character who wrote all this, we stan πŸ«ΆπŸ‘‘


and that's the page!! this was libzt 0.3.1, dated January 12, 2020, and it lives in section ZT_CMP_BOOL(3) of the manual πŸ’…βœ¨ mwah, go write some boolean claims bestie πŸ’œ