SDL_PRINTF_VARARG_FUNC(3)
π SDL_PRINTF_VARARG_FUNC π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, this one lives in SDL_PRINTF_VARARG_FUNC and it's literally just a little macro that tells the compiler "hey, this vararg function does the printf thing" π«Ά
β¨ NAME β¨
SDL_PRINTF_VARARG_FUNC β a macro that annotates a vararg function that operates like printf. no cap, that's the whole job π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
π¦ DESCRIPTION π¦
so the vibe is: if we were to annotate fprintf, it would look like this π
int fprintf(FILE *f, const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
what this notes is that the second parameter should be a printf-style format string, followed by .... and then the compiler β or other analysis tools β can warn when this doesn't appear to be the case. it's giving built-in proofreader energy, honestly π
on compilers without this annotation mechanism, this is defined to nothing. yeah. it just quietly becomes nothing. it's fine. it's fine π
this can (and should) be used with SDL_PRINTF_FORMAT_STRING as well β between them, they will cover at least Visual Studio, GCC, and Clang. so like, use both, bestie, they're a matched set π
β¨
β AVAILABILITY β
this macro is available since SDL 3.2.0 π
and that's a wrap on this lil macro, you ate, go forth and annotate your varargs π
Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_PRINTF_VARARG_FUNC(3) β mwah, xoxo, see you in the next manpage ππ§
π¦ 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