SDL_PRIX32(3)
π SDL_PRIX32 π
okay bestie, so this is the SDL_PRIX32 page from the SDL3 FUNCTIONS corner of the SDL_PRIX32(3) manual, and honestly? it's a tiny little macro but it's iconic and you're gonna love her π
β¨ NAME β¨
SDL_PRIX32 β it's a printf-formatting string that lets you print a Uint32 value as upper-case hexadecimal. that's it. that's the whole job. queen of doing one thing and doing it flawlessly π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
#define SDL_PRIX32 "X"
like. look at her. one single "X". so small. so powerful. π¦
π DESCRIPTION π
so the way that you use this is you stick it in your format string and let printf-style concatenation do its little magic. use it like this:
SDL_Log("There are %" SDL_PRIX32 " bottles of beer on the wall.", bottles);
see how the % is hanging out right before it? that's the vibe. the % does the percent-y part, SDL_PRIX32 expands to "X", and the compiler smooshes the string literals together so the whole thing is just %X at runtime. no cap, it's giving string-literal-adjacency sorcery β¨
and why does this macro even exist instead of you just typing "X" yourself? because the correct format specifier for a Uint32 is not the same everywhere, and using the macro means you never have to think about it. you just get upper-case hex, correctly, forever. periodt. π
π AVAILABILITY π
this macro has been available since SDL 3.2.0. so if you're on anything older, sorry babe, she's not there yet π
and that's the whole page! short and sweet, just like a good macro should be π
cute lil sign-off: this was served up fresh from the Simple Directmedia Layer, rocking SDL 3.4.18, and yeah it's SDL_PRIX32(3) all the way down. go forth and print your hex, 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