SDL_max(3)
π SDL_max(3) β SDL3 FUNCTIONS π
okay bestie, welcome to the SDL_max page, it's a short one but it's iconic, let's go β¨
πΈ NAME πΈ
SDL_max β return the greater of two values. that's it. that's the whole job. she picks the bigger one. π
π SYNOPSIS π
#include <SDL3/SDL_stdinc.h>
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
look at her. one line. no notes. π«Ά
π¦ DESCRIPTION π¦
so this is a helper macro, and honestly? it might be more clear than writing out the comparisons directly yourself, like, why type the whole ternary when she's right there. and she works with any type that can be compared with the > operator, so she's flexible, she's versatile, she's giving main character energy. π
β οΈ BUT. and this is the important part, bestie, do NOT skip this. she double-evaluates both of her parameters. so do not use expressions with side-effects here. fr fr. if your argument does something (like i++ or a function call that changes stuff), it's gonna happen twice and you're gonna have a bad time. π
π MACRO PARAMETERS π
xβ the first value to compare. πyβ the second value to compare. πΈ
β RETURN VALUE β
returns the greater of x and y. whoever's bigger wins, periodt. π
π THREAD SAFETY π
it is safe to call this macro from any thread. no locking, no drama, no vibe check needed. go off. β¨
π AVAILABILITY π
this macro is available since SDL 3.2.0. so if you're on something older... girl. upgrade. π
that's the whole page, you ate that. π this little gem comes to you from the Simple Directmedia Layer crew, SDL 3.4.18, and yes she's SDL_max(3), always and forever. mwah. πβ¨π
π¦ 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