adime_va_list(3)

πŸ“¦ version 2.2.1, in fedora 43, fedora 44

πŸ’– adime_va_list β€” bestie's guide to portable varargs πŸ’–

okay so real talk: this is the adime_va_list family from the Adime API reference (manual page adime_va_list(3), she's iconic, she's 3 pages deep in the reference, she's your girl). ✨

🌸 NAME 🌸

adime_va_list, adime_va_start, adime_va_arg, adime_va_end β€” the whole girl group, four members, no solo careers, they only perform together. πŸŽ€


✨ SYNOPSIS ✨

#include <adime.h>

typedef adime_va_list;

void adime_va_start(adime_va_list ap, first_arg);

TYPE adime_va_arg(adime_va_list ap, TYPE);

void adime_va_end(adime_va_list ap);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea. πŸ’… the C language has some weirdnesses (shocking, I know, the C language being weird, unheard of, never happened before). and because of those weirdnesses, some things that Adime does with va_lists would not be portable if it just used a va_list directly. like, it would simply not slay on every platform. tragic.

so instead, bestie, you always have to use this replacement API. and the way that it's literally a glow-up of the standard API β€” it works exactly like the standard API for va_lists, except it's more portable. that's the whole vibe. same energy, better portability. 🫢

and here's the extra cute part that makes it special: if you pass an adime_va_list to another function, and that function reads an argument with adime_va_arg(), then the adime_va_list will have advanced to the same position in the calling function as in the called function. like it stays in sync, no cap, they're communicating, they're a team. πŸ”₯

in particular β€” and this is the part you're gonna wanna remember β€” after calling adime_vdialogf(), the adime_va_list will have advanced to after the last argument used by Adime. periodt. πŸ‘‘


πŸ’œ the example πŸ’œ

the following example shows how adime_dialogf() is implemented in terms of adime_vdialogf(). so like, this is the blueprint, the main character energy in code form:

int adime_dialogf(char *title, int x, int y, int edit_w,
                  char *format, ...)
{
   int ret;
   va_list ap;

   va_start(ap, format);
   ret = adime_vdialogf(title, x, y, edit_w, format, ap);
   va_end(ap);

   return ret;
}
ngl if you want the full lore, go read the documentation for the standard va_list, va_start(), va_arg() and va_end() β€” this whole thing is basically their cooler, more portable cousin. 🧚

🌈 SEE ALSO 🌈


and that's the page, bestie!! πŸŽ€ this whole vibe is Adime version 2.2.1 β€” she said version 2.2.1 and she meant it. go forth and variadic, you're gonna do amazing, mwah πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from