SDL_PRILLx(3)
π SDL_PRILLx β bestie edition
okay so you're in the SDL3 FUNCTIONS manual, section 3, and today's main character is SDL_PRILLx. π
β¨ NAME β¨
SDL_PRILLx β it's a printf-formatting string, and it's specifically for printing an unsigned long long value as lower-case hexadecimal. that's it. that's the whole job. she's niche but she's iconic. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
#define SDL_PRILLx SDL_PRILL_PREFIX "x"
like, literally that's the whole definition. no cap. π
π¦ DESCRIPTION π¦
so the vibe here is: you know how printf and friends need those little <inttypes.h> macros so your format string matches your actual integer type, and if you get it wrong everything explodes into undefined behaviour? yeah. this is SDL's version of that, and she ate. π₯
use it like this:
SDL_Log("There are %" SDL_PRILLx " bottles of beer on the wall.", bottles);
see how the macro gets string-concatenated right into the middle of the format string? that's the move. the % lives in your string, the macro supplies the conversion specifier, and they snap together like they were always meant to be. π
ngl, string literal concatenation like this is the whole reason these PRI* macros exist as macros and not just as variables. iykyk. π§
β AVAILABILITY β
this macro has been around since SDL 3.2.0. so if you're on anything older, bestie, it's not there and you're gonna have a bad time. π
π SEE ALSO π
okay technically this section isn't in the original but the energy is: go look at the other SDL_PRI* siblings if you need a different integer type or a different base, because she has a whole family and they're all serving. π«Ά
fr fr, don't just guess the format specifier for your type. use the macro. future you, staring at a segfault at 2am, will thank you. π
sign-off time, besties π this page comes to you from Simple Directmedia Layer, it's for SDL 3.4.18, and the page itself is SDL_PRILLx(3). mwah. go print some hex. πβ¨
π¦ 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