SDL_WPRINTF_VARARG_FUNCV(3)

πŸ’– NAME πŸ’–

SDL_WPRINTF_VARARG_FUNCV β€” a macro that annotates a va_list function that operates like wprintf. bestie it's literally just vibes for your compiler 🫢


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

#define SDL_WPRINTF_VARARG_FUNCV( fmtargnumber ) /* __attribute__ (( format( __wprintf__, fmtargnumber, 0 ))) */

🌸 DESCRIPTION 🌸

okay so picture this. say we're annotating vfwprintf, right? it'd look like this:

int vfwprintf(FILE *f, const wchar_t *fmt, va_list ap) SDL_WPRINTF_VARARG_FUNC(2);

what that's doing β€” and this is the whole point β€” is noting that the second parameter should be a wprintf-style format wide string, followed by a va_list. that's it, that's the tea. once your compiler (or whatever other analysis tools you're running) knows that, it can warn you when it doesn't appear to be the case. no cap, it's giving built-in bestie who checks your work πŸ’…

and here's the thing: on compilers without this annotation mechanism, this is defined to nothing. like, poof, empty, gone. it just quietly doesn't exist there and nothing breaks. iconic behavior honestly πŸ¦‹

you can β€” and lowkey should β€” use this with SDL_PRINTF_FORMAT_STRING as well, and between the two of them you'll cover at least Visual Studio, GCC, and Clang. all the big ones. slay πŸ”₯


πŸŽ€ AVAILABILITY πŸŽ€

this macro is available since SDL 3.2.0. so if you're on anything older... bestie, upgrade πŸ’€


that's the whole page!! go annotate something and let your compiler be your hype woman πŸ’œβœ¨

mwah πŸ’‹ β€” brought to you by the fine folks at Simple Directmedia Layer, SDL 3.4.18, and yes this lil doc is SDL_WPRINTF_VARARG_FUNCV(3) herself, in the SDL3 FUNCTIONS lineup πŸŒˆπŸŽ€

πŸ“¦ where this page comes from