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