SDL_SCANF_VARARG_FUNCV(3)
π SDL_SCANF_VARARG_FUNCV π
okay bestie, welcome to the SDL_SCANF_VARARG_FUNCV page from the SDL3 FUNCTIONS manual, no cap π«Ά
β¨ NAME β¨
SDL_SCANF_VARARG_FUNCV β a macro that annotates a va_list function that operates like scanf. it's giving "tell the compiler what this function actually is" energy π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
#define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __scanf__, fmtargnumber, 0 )))
π¦ DESCRIPTION π¦
so like, imagine we wanted to annotate vfscanf. it would look like this, literally:
int vfscanf(FILE *f, const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2);
what this is doing is noting that the second parameter should be a scanf-style format string, and it's followed by a va_list. that's it, that's the whole vibe. then the compiler (or whatever other analysis tools you've got lurking around) can warn when this doesn't appear to be the case. main character energy for your static analysis π₯
on compilers without this annotation mechanism, this is defined to nothing. so likeβ¦ it just evaporates. ghosted. π
also!! this can (and should) be used with SDL_SCANF_FORMAT_STRING as well β between the two of them, they'll cover at least Visual Studio, GCC, and Clang. trio slay β¨
π AVAILABILITY π
this macro is available since SDL 3.2.0. so if you're on anything older, bestieβ¦ upgrade π
ngl, the way these two macros team up to cover three whole compilers is lowkey iconic. use them together, iykyk π
that's the whole page, fr fr. stay safe out there and annotate your variadic functions π
ππβ¨ this was brought to you by Simple Directmedia Layer, version SDL 3.4.18 β mwah, bye bestie! ππ¦πΈ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms